Sucrose is an attractive feeding substance and a positive reinforcer for Drosophila. But Drosophila females have been shown to robustly reject a sucrose-containing option for egg-laying when given a choice between a plain and a sucrose-containing option in specific contexts. How the sweet taste system of Drosophila promotes context-dependent devaluation of an egg-laying option that contains sucrose, an otherwise highly appetitive tastant, is unknown. Here, we report that devaluation of sweetness/sucrose for egg-laying is executed by a sensory pathway recruited specifically by the sweet neurons on the legs of Drosophila. First, silencing just the leg sweet neurons caused acceptance of the sucrose option in a sucrose versus plain decision, whereas expressing the channelrhodopsin CsChrimson in them caused rejection of a plain option that was “baited” with light over another that was not. Analogous bidirectional manipulations of other sweet neurons did not produce these effects. Second, circuit tracing revealed that the leg sweet neurons receive different presynaptic neuromodulations compared to some other sweet neurons and were the only ones with postsynaptic partners that projected prominently to the superior lateral protocerebrum (SLP) in the brain. Third, silencing one specific SLP-projecting postsynaptic partner of the leg sweet neurons reduced sucrose rejection, whereas expressing CsChrimson in it promoted rejection of a light-baited option during egg-laying. These results uncover that the Drosophila sweet taste system exhibits a functional division that is value-based and task-specific, challenging the conventional view that the system adheres to a simple labeled-line coding scheme.