The Southern green shield bug, Nezara viridula, is an invasive piercing and sucking pest insect that feeds on crops and poses a threat to global food production. Insects live in close relationships with microorganisms providing their host with unique capabilities, such as resistance to toxic plant metabolites. In this study, we investigated the resistance to and detoxification of the plant metabolite 3-nitropropionic acid by core and transient members of the N. viridula microbial community. Microbial community members showed a different tolerance to the toxin and we determined that six out of eight strains detoxified 3-nitropropionic acid. Additionally, we determined that 3-nitropropionic acid might interfere with the biosynthesis and transport of L-leucine. Moreover, our study explored the influence of diet on the gut microbial composition of N. viridula, demonstrating that switching to a single-plant diet shifts the abundance of core microbes. In line with this, testing pairwise microbial interactions revealed that core microbiota members support each other and repress the growth of transient microorganisms. With this work, we provide novel insights into the factors shaping the insect gut microbial communities and demonstrate that N. viridula harbours many toxin-degrading bacteria that could support its resistance to plant defences.