Ingesting pathogens through spoiled food can cause serious harm, including infections, tissue damage, and even death. To prevent these outcomes, many animals have evolved behaviors to avoid consuming harmful pathogens. While pathogen avoidance behavior is conserved across species, the mechanisms linking immune responses of the body with neuron-controlled behavior remain unclear. Building on our previous findings, we here present a new bidirectional body-brain communication between the fat body and the nervous system that drives immune receptor-induced avoidance behavior. We show that immune receptor signaling and a specific antimicrobial peptide (AMP) are essential in both octopaminergic neuromodulatory neurons and the fat body for rapidly reducing pathogen intake after initial ingestion. Mechanistically, the octopaminergic neurons innervate the fly fat body where they trigger a calcium response through a specific octopamine receptor. This octopaminergic signal prompts the fat body to release dopamine. In turn, Dop1R1 signaling in output neurons of the mushroom body, the insect higher brain center, drives pathogen avoidance. Together, our data suggest that ingested pathogens are detected by immune receptors in neurons, which, through synaptic connections, trigger the release of dopamine and AMPs from fat cells. While AMPs combat the pathogens, dopamine reduces further ingestion by inducing behavioral changes. This mechanism demonstrates efficient communication between the body and brain, coordinating survival behaviors through systemic dopamine signaling from the fat body to the brain.