Gut microbiota plays a key role in physiological processes of insects, including nutritional metabolism, development, immunity and detoxification. Environmental stressors such as herbicides, used to optimize and improve crop yields, may interfere with the mutualistic relationships causing negative consequences for the host health. Dinitroaniline herbicides, for example pendimethalin, are used worldwide in pre‐emergence application to control grass and some broadleaf weeds. They target microtubules to arrest cell division and inhibit the development of roots and shoots. Effects of a pendimethalin‐based herbicide were assessed on the gut microbial community of Pterostichus melas italicus Dejean, 1828 (Coleoptera, Carabidae). The exposure effect was tested in vivo by using a recommended field rate (4 L per ha, 330 gL−1 of active ingredient) and evaluating the variability of responses in 21 days, corresponding to the half‐life of pendimethalin. The 16S rRNA sequencing data showed that the gut lumen was dominated by Proteobacteria, Firmicutes, Fusobacteria, Tenericutes and Bacteroidetes. The exposure interfered with the bacterial community richness and diversity associated with the gut from 2 days after the treatment. The differential abundance analyses highlighted a shift involving Lactobacillaceae, Streptomycetaceae, Neisseriaceae, Ruminococcaceae and Enterobacteriaceae. An increase in species such as Enterobacter sp., Pseudomonas sp., Pantoea sp and Paracoccus sp. involved in the herbicide degradation was also recorded after 21 days of exposure. Phylogenetic investigation of communities by reconstruction of unobserved states (PICRUSt) analysis indicated that the exposure has effects on the most predicted functional categories of gut microbiota related to metabolic function including carbohydrate, amino acid and lipid metabolism. These results demonstrate that pendimethalin can impact microbial communities associated with generalist predators inhabiting croplands leading to severe implications for the species’ ecological role. Understanding the effects of herbicides such as pendimethalin on ground beetles may help to protect beneficial soil insects that have a crucial role in the ecosystem services.