Polycystic ovary syndrome (PCOS) is an endocrine and metabolic disorder characterized by chronic low-grade inflammation. Previous studies have demonstrated that the gut microbiome can affect the host tissue cells’ mRNA N6-methyladenosine (m6A) modifications. This study aimed to understand the role of intestinal flora in ovarian cells inflammation by regulating mRNA m6A modification particularly the inflammatory state in PCOS. The gut microbiome composition of PCOS and Control groups was analyzed by 16S rRNA sequencing, and the short chain fatty acids were detected in patients’ serum by mass spectrometry methods. The level of butyric acid was found to be decreased in the serum of the obese PCOS group (FAT) compared to other groups, and this was correlated with increased Streptococcaceae and decreased Rikenellaceae based on the Spearman’s rank test. Additionally, we identified FOSL2 as a potential METTL3 target using RNA-seq and MeRIP-seq methodologies. Cellular experiments demonstrated that the addition of butyric acid led to a decrease in FOSL2 m6A methylation levels and mRNA expression by suppressing the expression of METTL3, an m6A methyltransferase. Additionally, NLRP3 protein expression and the expression of inflammatory cytokines (IL-6 and TNF-α) were downregulated in KGN cells. Butyric acid supplementation in obese PCOS mice improved ovarian function and decreased the expression of local inflammatory factors in the ovary. Taken together, the correlation between the gut microbiome and PCOS may unveil crucial mechanisms for the role of specific gut microbiota in the pathogenesis of PCOS. Furthermore, butyric acid may present new prospects for future PCOS treatments.Supplementary InformationThe online version contains supplementary material available at 10.1186/s13148-023-01487-9.