During olfactory associative learning in Drosophila, odors activate specific subsets of intrinsic mushroom body (MB) neurons. Coincident exposure to either rewards or punishments is thought to activate extrinsic dopaminergic neurons, which modulate synaptic connections between odor-encoding MB neurons and MB output neurons to alter behaviors. However, here we identify two classes of intrinsic MB γ neurons based on cAMP response element (CRE)-dependent expression, γCRE-p and γCRE-n, which encode aversive and appetitive valences. γCRE-p and γCRE-n neurons act antagonistically to maintain neutral valences for neutral odors. Activation or inhibition of either cell type upsets this balance, toggling odor preferences to either positive or negative values. The mushroom body output neurons, MBON-γ5β'2a/β'2mp and MBON-γ2α'1, mediate the actions of γCRE-p and γCRE-n neurons. Our data indicate that MB neurons encode valence information, as well as odor information, and this information is integrated through a process involving MBONs to regulate learning and memory.