Background: Obstructive sleep apnea (OSA) is considered to be an independent factor affecting lipid metabolism. This study explored the relationship between immune genes and lipid metabolism in OSA.Methods: Immune-related Differentially Expressed Genes (DEGs) were identified by analyzing microarray data sets from the Gene Expression Omnibus (GEO) database. Subsequently, we conducted protein-protein interaction (PPI) network analysis and calculated their Gene Ontology (GO) semantic similarity. The GO, Kyoto Encyclopedia of Genes and Genomes (KEGG) pathways, Disease Ontology (DO), gene set enrichment analysis (GSEA), and gene set variation analysis (GSVA) were employed for functional enrichment analyses and to determine the most significant functional terms. Combined with the results of boruta and random forest, we selected predictors to build a prognostic model, along with seeking out the potential TFs and target drugs for the predictive genes.Results: Immune-related DEGs included 64 genes upregulated and 98 genes downregulated. The enrichment analysis might closely associate with cell adhesion and T cell-mediated immunity pathways and there were many DEGs involved in lipid and atherosclerosis signaling pathways. The highest-ranking hub gene in PPI network have been reported lowly expressed in OSA. In line with the enrichment analysis, DO analysis reveal that respiratory diseases may be associated with OSA besides immune system disorders. Consistent with the result of the KEGG pathway, the analysis of GSVA revealed that the pro-inflammation pathways are associated with OSA. Monocytes and CD8 T cells were the predominant immune cells in adipose tissue. We built a prognostic model with the top six genes, and the prognostic genes were involved in the polarization of macrophage and differentiation of T lymphocyte subsets. In vivo experimental verification revealed that EPGN, LGR5, NCK1 and VIP were significantly down-regulated while PGRMC2 was significantly up-regulated in mouse model of OSA.Conclusions: Our study demonstrated strong associations between immune genes and the development of dyslipidemia in OSA. This work promoted the molecular mechanisms and potential targets for the regulation of lipid metabolism in OSA.