ObjectiveOsteonecrosis of the femoral head (ONFH) is a common orthopedic condition that will prompt joint dysfunction, significantly impacting patients’ quality of life. However, the specific pathogenic mechanisms underlying this disease remain elusive. The objective of this study is to examine the differentially expressed messenger RNAs (DE mRNAs) and key genes linked to ONFH, concurrently investigating the immune cell infiltration features in ONFH patients through the application of the CIBERSORT algorithm.MethodsMicroarray was applied to scrutinize mRNA expression profiles in both ONFH patients and healthy controls, with data integration sourced from the GEO database. DE mRNAs were screened using the Limma method. The biological functions of DE mRNAs were explored through the Kyoto Encyclopedia of Genes and Genomes (KEGG) pathway enrichment analysis, Gene Ontology (GO) functional analysis, and Gene Set Enrichment Analysis (GSEA). Additionally, support vector machine–recursive feature elimination (SVM-RFE) and the least absolute shrinkage and selection operator (LASSO) were employed to discern diagnostic biomarkers associated with the disease. Receiver operating characteristic (ROC) analysis was utilized to assess the statistical performance of the feature genes. The validation of key genes was performed using qRT-PCR in bone tissues obtained from ONFH patients and healthy controls. Osteogenic differentiation of BMSC was then performed and detected by alkaline phosphatase staining (ALP) and qRT-PCR to verify the correlation between key genes and osteogenic differentiation. Finally, immune cell infiltration analysis was executed to evaluate immune cell dysregulation in ONFH, concurrently exploring the correlation between the infiltration of immune cells and key genes.ResultsAfter consolidating the datasets, the Limma method revealed 107 DEGs, comprising 76 downregulated and 31 upregulated genes. Enrichment analysis revealed close associations of these DE mRNAs with functions such as cell migration, osteoblast differentiation, cartilage development and extracellular region. Machine learning algorithms further identified APOD, FBXO43 and LRP12 as key genes. ROC curves demonstrated the high diagnostic efficacy of these genes. The results of qRT-PCR showed that the expression levels of key genes were consistent with those of microarray analysis. In addition, the results of in vitro experiments showed that APOD was closely related to osteogenic differentiation of BMSC. Immune infiltration analysis suggested a close correlation between ONFH and imbalances in levels of Neutrophils, Monocytes, Macrophages M2, Dendritic cells activated and Dendritic cells resting.ConclusionAPOD is closely related to osteogenic differentiation of BMSCs and can be used as a diagnostic marker of ONFH. Immune cell infiltration significantly differs between controls and ONFH patients.