BackgroundPatients with polycystic ovary syndrome (PCOS) exhibit a chronic inflammatory state, which is often accompanied by immune, endocrine, and metabolic disorders. Clarification of the pathogenesis of PCOS and exploration of specific biomarkers from the perspective of immunology by evaluating the local infiltration of immune cells in the follicular microenvironment may provide critical insights into disease pathogenesis.MethodsIn this study, we evaluated immune cell subsets and gene expression in patients with PCOS using data from the Gene Expression Omnibus database and single-sample gene set enrichment analysis.ResultsIn total, 325 differentially expressed genes were identified, among whichTMEM54andPLCG2(area under the curve = 0.922) were identified as PCOS biomarkers. Immune cell infiltration analysis showed that central memory CD4+T cells, central memory CD8+T cells, effector memory CD4+T cells, γδ T cells, and type 17 T helper cells may affect the occurrence of PCOS. In addition,PLCG2was highly correlated with γδ T cells and central memory CD4+T cells.ConclusionsOverall,TMEM54andPLCG2were identified as potential PCOS biomarkers by bioinformatics analysis. These findings established a basis for further exploration of the immunological mechanisms of PCOS and the identification of therapeutic targets.Supplementary InformationThe online version contains supplementary material available at 10.1186/s12884-023-05693-4.