Epigenetic regulation plays an essential role in immunity and inflammation in endometriosis. In this study, we aimed to explore differences in m6A regulators between endometriosis patients and normal women and analyze the effect of m6A modification on immune and inflammatory microenvironment. The samples for analysis were downloaded from the Gene Expression Omnibus database, including ectopic endometrium (EC), eutopic endometrium (EU), and normal eutopic endometrium (NM) samples from non-endometriosis women. The validation process involved utilizing our previous RNA-sequencing data. Subsequently, a correlation analysis was performed to ascertain the relationship between m6A and the inflammatory microenvironment profile, encompassing infiltrating immunocytes, immune-inflammation reaction gene sets, and human leukocyte antigen genes. LASSO analyses were used to develop risk signature. The findings of this study indicate that the m6A regulators FTO were observed to be significantly up-regulated, while YTHDF2, CBLL1, and METTL3 were down-regulated in endometriosis tissues. The CIBERSORT analysis revealed that the local inflammatory microenvironment of ectopic lesions plays a crucial role in the development of endometriosis. Notably, M2 macrophages exhibited a significant difference between the EC and NM groups. Moreover, M2 macrophages demonstrated a positive correlation with FTO (0.39) and a negative correlation with CBLL1 (-0.35). Furthermore, consistent clustering of EC and EU samples resulted in the identification of three distinct cell subtypes. Among different cell subtypes, significant differences were in immunoinfiltrating cells, plasma cells, naive CD4 T cells, memory activated CD4 T cells, gamma delta T cells, resting NK cells and activated NK cells but not in macrophages. Furthermore, the identification of various compounds capable of targeting these m6A genes was achieved. In conclusions, our integrated bioinformatics analysis results demonstrated that m6A-related genes METTL3, CBLL1 and YTHDF2 may be useful biomarkers for endometriosis in ectopic endometrium. The potential therapeutic approach of targeting m6A regulators holds promise for the treatment of endometriosis.