After Drosophila males are rejected by mated females, their subsequent courtship is inhibited even when encountering virgin females. Molecular mechanisms underlying courtship conditioning in the CNS are unclear. In this study, we find that tyramine β hydroxylase (TβH) mutant males unable to synthesize octopamine (OA) showed impaired courtship conditioning, which could be rescued by transgenic TβH expression in the CNS. Inactivation of octopaminergic neurons mimicked the TβH mutant phenotype. Transient activation of octopaminergic neurons in males not only decreased their courtship of virgin females, but also produced courtship conditioning. Single cell analysis revealed projection of octopaminergic neurons to the mushroom bodies. Deletion of the OAMB gene encoding an OA receptor expressed in the mushroom bodies disrupted courtship conditioning. Inactivation of neurons expressing OAMB also eliminated courtship conditioning. OAMB neurons responded robustly to male-specific pheromone cis-vaccenyl acetate in a dose-dependent manner. Our results indicate that OA plays an important role in courtship conditioning through its OAMB receptor expressed in a specific neuronal subset of the mushroom bodies.