Mating preferences are common in natural populations, and their divergence among populations is considered an important source of reproductive isolation during speciation. Although mechanisms for the divergence of mating preferences have received substantial theoretical treatment, complementary experimental tests are lacking. We conducted a laboratory evolution experiment, using the fruit fly Drosophila serrata, to explore the role of divergent selection between environments in the evolution of female mating preferences. Replicate populations of D. serrata were derived from a common ancestor and propagated in one of three resource environments: two novel environments and the ancestral laboratory environment. Adaptation to both novel environments involved changes in cuticular hydrocarbons, traits that predict mating success in these populations. Furthermore, female mating preferences for these cuticular hydrocarbons also diverged among populations. A component of this divergence occurred among treatment environments, accounting for at least 17.4 of the among-population divergence in linear mating preferences and 17.2 of the among-population divergence in nonlinear mating preferences. The divergence of mating preferences in correlation with environment is consistent with the classic by-product model of speciation in which premating isolation evolves as a side effect of divergent selection adapting populations to their different environments.