Food choice, in animals, has been known to change with internal nutritional state and also with variable dietary conditions. To better characterize mechanisms of diet-induced plasticity of food preference in Drosophila melanogaster, we synthesized diets with macronutrient imbalances and examined how food choice and taste sensitivity were modified in flies that fed on these diets. We found that dietary macronutrient imbalances caused compensatory behavioral shifts in both sexes to increase preference for the macronutrient that was scant in the food source, and simultaneously reduce preference for the macronutrient that was enriched. Further analysis with females revealed analogous changes in sweet taste responses in labellar neurons, with increased sensitivity on sugar-reduced diet and decreased sensitivity on sugar-enriched diet. Interestingly, we found differences in the onset of changes in taste sensitivity and behavior, which occur over 1-4 d, in response to dietary sugar reduction or enrichment. To investigate molecular mechanisms responsible for diet-induced taste modulation, we used candidate gene and transcriptome analyses. Our results indicate that signaling via Dop2R is involved in increasing cellular and behavioral sensitivity to sugar as well as in decreasing behavioral sensitivity to amino acids on dietary sugar reduction. On the other hand, cellular and behavioral sensitivity to sugar relies on dilp5 and a decrease in sugar preference following dietary sugar abundance was correlated with downregulation of dilp5 Together, our results suggest that feeding preference for sugar and amino acid can be modulated independently to facilitate food choice that accounts for prior dietary experience.SIGNIFICANCE STATEMENT Animals adjust their feeding preferences based on prior dietary experiences. Here, we find that upon dietary macronutrient deprivation, flies undergo compensatory changes in food preference. The altered preference correlates with changes in peripheral taste sensitivity. While Dop2R mediates changes following dietary sugar reduction, downregulation of dilp5 is associated with changes caused by a sugar-enriched diet. This study contributes to a better understanding of neurophysiological plasticity of the taste system in flies, and its role in facilitating adjustment of foraging behavior based on nutritional requirements.