Speciation is facilitated by “magic traits,” where divergent natural selection on such traits also results in assortative mating. In animal populations, diet has the potential to act as a magic trait if populations diverge in consumed food that incidentally affects mating and therefore sexual isolation. While diet‐based assortative mating has been observed in the laboratory and in natural populations, the mechanisms causing positive diet‐based assortment remain largely unknown. Here, we experimentally created divergent diets in a sexually imprinting species of mouse, Peromyscus gossypinus (the cotton mouse), to test the hypothesis that sexual imprinting on diet could be a mechanism that generates rapid and significant sexual isolation. We provided breeding pairs with novel garlic‐ or orange‐flavored water and assessed whether their offspring, exposed to these flavors in utero and in the nest before weaning, later preferred mates that consumed the same flavored water as their parents. While males showed no preference, females preferred males of their parental diet, which is predicted to yield moderate sexual isolation. Thus, our experiment demonstrates the potential for sexual imprinting on dietary cues learned in utero and/or postnatally to facilitate reproductive isolation and potentially speciation.