Objectives: Bone immune disorders are major contributors to osteoporosis development. This study aims to identify potential diagnostic markers and molecular targets for osteoporosis treatment from an immunological perspective.Method: We downloaded dataset GSE56116 from the Gene Expression Omnibus database, and identified differentially expressed genes (DEGs) between normal and osteoporosis groups. Subsequently, differentially expressed immune-related genes (DEIRGs) were identified, and a functional enrichment analysis was performed. A protein-protein interaction network was also constructed based on data from STRING database to identify hub genes. Following external validation using an additional dataset (GSE35959), effective biomarkers were confirmed using RT-qPCR and immunohistochemical (IHC) staining. ROC curves were constructed to validate the diagnostic values of the identified biomarkers. Finally, a ceRNA and a transcription factor network was constructed, and a Gene Ontology and Kyoto Encyclopedia of Genes and Genomes enrichment analysis was performed to explore the biological functions of these diagnostic markers.Results: In total, 307 and 31 DEGs and DEIRGs were identified, respectively. The enrichment analysis revealed that the DEIRGs are mainly associated with Gene Ontology terms of positive regulation of MAPK cascade, granulocyte chemotaxis, and cytokine receptor. protein–protein interaction network analysis revealed 10 hub genes: FGF8, KL, CCL3, FGF4, IL9, FGF9, BMP7, IL17RA, IL12RB2, CD40LG. The expression level of IL17RA was also found to be significantly high. RT-qPCR and immunohistochemical results showed that the expression of IL17RA was significantly higher in osteoporosis patients compared to the normal group, as evidenced by the area under the curve Area Under Curve of 0.802. Then, we constructed NEAT1-hsa-miR-128-3p-IL17RA, and SNHG1-hsa-miR-128-3p-IL17RA ceRNA networks in addition to ERF-IL17RA, IRF8-IL17RA, POLR2A-IL17RA and ERG-IL17RA transcriptional networks. Finally, functional enrichment analysis revealed that IL17RA was involved in the development and progression of osteoporosis by regulating local immune and inflammatory processes in bone tissue.Conclusion: This study identifies the immune-related gene IL17RA as a diagnostic marker of osteoporosis from an immunological perspective, and provides insight into its biological function.