Abstract This study aims to investigate the structure and diversity of the intestinal microbiome of Gryllus bimaculatus from wild and farmed environments. Additionally, we sought to identify the core microbes to get information on the microbial diversity of the gut microbiome to the farm condition. We analyzed the microbial community diversity in intestinal samples of both wild and farmed G. bimaculatus using high-throughput sequencing of 16S rRNA gene and ITS rRNA amplicons. Using the PICRUSt2 software, we predicted the functional capabilities of bacterial communities. The analysis indicated significant differences in the diversity of the microbial communities (bacteria) within the gut of crickets under farmed and wild conditions, with notably higher bacterial diversity observed in the gut of farmed crickets compared to those in the wild. The gut bacterial communities exhibited significant similarity across the two conditions, and the variations in diversity are primarily influenced by species with low abundance. Genus-level analysis revealed that the abundance of pathogens, including genera Listeria, Staphylococcus, and Candida, was significantly higher in the gut microbiota of farmed crickets than in the wild ones. By identifying core genera (present in over 80% of the samples), we discovered 19 bacterial genera and 1 fungal genus. The core bacterial genera constituted 60.35% and 87.10% of the cricket’s gut bacterial abundance in farmed and wild environments, respectively. The functional prediction analysis performed using PICRUSt2 identified a significant increase of pathways about “Terpenoids and polyketides metabolism”, and “Infectious disease: bacterial” in the farmed group; as well as a significant decrease in pathways about “Environmental adaptation”, “Development and regeneration”, and the “Nervous system”, compared to the wild group. In conclusion our results showed that the gut microbial community of the G. bimaculatus could be influenced by its environment and diet. However, this influence is primarily manifested in the variation of low-abundance genera, with the gut microbial community remains dominated by a few microbial groups. Therefore, it is speculated that the combination of core and edge species in the gut microbial community of the G. bimaculatus may constitute an effective strategy that not only maintains the core functions of the community but also adapts to environmental changes through the diversity of edge species. The high population density and excessive feeding in the farmed condition could have allowed for the creation of a more diverse gut microbiota for G. bimaculatus, including potential pathogens. Therefore, when breeding G. bimaculatus, the environmental hygiene management should be strengthened to reduce the carrying and transmission of pathogens.