The primary metabolism of plants, which is mediated by nitrogen, is closely related to the defense response to insect herbivores. An experimental system was established to examine how nitrogen mediated tomato resistance to an insect herbivore, the oriental fruit fly (Bactrocera dorsalis). All tomatoes were randomly assigned to the suitable nitrogen (control, CK) treatment, nitrogen excess (NE) treatment and nitrogen deficiency (ND) treatment. We found that nitrogen excess significantly increased the aboveground biomass of tomato and increased the pupal biomass of B. dorsalis. Metabolome analysis showed that nitrogen excess promoted the biosynthesis of amino acids in healthy fruits, including γ-aminobutyric acid (GABA), arginine and asparagine. GABA was not a differential metabolite induced by injury by B. dorsalis under nitrogen excess, but it was significantly induced in infested fruits at appropriate nitrogen levels. GABA supplementation not only increased the aboveground biomass of plants but also improved the defensive response of tomato. The biosynthesis of GABA in tomato is a resistance response to feeding by B. dorsalis in appropriate nitrogen, whereas nitrogen excess facilitates the pupal weight of B. dorsalis by inhibiting synthesis of the GABA pathway. This study concluded that excess nitrogen inhibits tomato defenses in plant-insect interactions by inhibiting GABA synthesis, answering some unresolved questions about the nitrogen-dependent GABA resistance pathway to herbivores.