Animals must adapt their dietary choices to meet their nutritional needs. How these needs are detected and translated into nutrient-specific appetites that drive food-choice behaviors is poorly defined. Here, we show that the enteroendocrine cells (EECs) of the adult female Drosophila midgut sense nutrients and in response release neuropeptide F (NPF), an ortholog of mammalian NPY-family gut-brain hormones. Gut-derived NPF acts via effects on glucagon-like adipokinetic hormone (AKH) signaling to induce sugar satiety and to drive hunger for protein-rich food, and on adipose tissue to promote storage of ingested nutrients. Suppression of gut NPF leads to overconsumption of dietary sugar while decreasing intake of protein-rich yeast. Furthermore, we show a female-specific function of gut-derived NPF in the suppression of AKH signaling after mating. This induces a dietary switch that promotes preference for protein-containing food to support reproduction. Together, our findings suggest that the gut NPF-AKH axis regulates appetite that drives specific food choices to ensure homeostatic consumption of nutrients, providing insight into the hormonal mechanisms that underlie nutrient-specific hungers.