Animals generally prefer nutrients and avoid toxic and harmful chemicals. Recent behavioral and physiological studies have identified that sweet-sensing gustatory receptor neurons (GRNs) in Drosophila melanogaster mediate appetitive behaviors toward fatty acids. Sweet-sensing GRN activation requires the function of the ionotropic receptors IR25a, IR56d, and IR76b, as well as the gustatory receptor GR64e. However, we reveal that hexanoic acid (HA) is toxic rather than nutritious to D. melanogaster. HA is one of the major components of the fruit Morinda citrifolia (noni). Thus, we analyzed the gustatory responses to one of major noni fatty acids, HA, via electrophysiology and proboscis extension response (PER) assay. Electrophysiological tests show this is reminiscent of arginine-mediated neuronal responses. Here, we determined that a low concentration of HA induced attraction, which was mediated by sweet-sensing GRNs, and a high concentration of HA induced aversion, which was mediated by bitter-sensing GRNs. We also demonstrated that a low concentration of HA elicits attraction mainly mediated by GR64d and IR56d expressed by sweet-sensing GRNs, but a high concentration of HA activates three gustatory receptors (GR32a, GR33a, and GR66a) expressed by bitter-sensing GRNs. The mechanism of sensing HA is biphasic in a dose dependent manner. Furthermore, HA inhibit sugar-mediated activation like other bitter compounds. Taken together, we discovered a binary HA-sensing mechanism that may be evolutionarily meaningful in the foraging niche of insects.