Postmenopausal osteoporosis (PMOP) is a common metabolic inflammatory disease. In conditions of estrogen deficiency, chronic activation of the immune system leads to a hypo-inflammatory phenotype and alterations in its cytokine and immune cell profile, although immune cells play an important role in the pathology of osteoporosis, studies on this have been rare. Therefore, it is important to investigate the role of immune cell-related genes in PMOP. PMOP-related datasets were downloaded from the Gene Expression Omnibus database. Immune cells scores between high bone mineral density (BMD) and low BMD samples were assessed based on the single sample gene set enrichment analysis method. Subsequently, weighted gene co-expression network analysis was performed to identify modules highly associated with immune cells and obtain module genes. Differential analysis between high BMD and low BMD was also performed to obtain differentially expressed genes. Module genes are intersected with differentially expressed genes to obtain candidate genes, and functional enrichment analysis was performed. Machine learning methods were used to filter out the signature genes. The receiver operating characteristic (ROC) curves of the signature genes and the nomogram were plotted to determine whether the signature genes can be used as a molecular marker. Gene set enrichment analysis was also performed to explore the potential mechanism of the signature genes. Finally, RNA expression of signature genes was validated in blood samples from PMOP patients and normal control by real-time quantitative polymerase chain reaction. Our study of PMOP patients identified differences in immune cells (activated dendritic cell, CD56 bright natural killer cell, Central memory CD4 T cell, Effector memory CD4 T cell, Mast cell, Natural killer T cell, T follicular helper cell, Type 1 T-helper cell, and Type 17 T-helper cell) between high and low BMD patients. We obtained a total of 73 candidate genes based on modular genes and differential genes, and obtained 5 signature genes by least absolute shrinkage and selection operator and random forest model screening. ROC, principal component analysis, and t-distributed stochastic neighbor embedding down scaling analysis revealed that the 5 signature genes had good discriminatory ability between high and low BMD samples. A logistic regression model was constructed based on 5 signature genes, and both ROC and column line plots indicated that the model accuracy and applicability were good. Five signature genes were found to be associated with proteasome, mitochondria, and lysosome by gene set enrichment analysis. The real-time quantitative polymerase chain reaction results showed that the expression of the signature genes was significantly different between the 2 groups. HIST1H2AG, PYGM, NCKAP1, POMP, and LYPLA1 might play key roles in PMOP and be served as the biomarkers of PMOP.