We consider a new ranking and selection problem in which the performance of each alternative depends on some observable random covariates. The best alternative is thus not constant but depends on the values of the covariates. Assuming a linear model that relates the mean performance of an alternative and the covariates, we design selection procedures producing policies that represent the best alternative as a function in the covariates. We prove that the selection procedures can provide certain statistical guarantee, which is defined via a nontrivial generalization of the concept of probability of correct selection that is widely used in the conventional ranking and selection setting.