Background: Sepsis is a clinical syndrome, due to a dysregulated inflammatory response to infection. Accumulating evidence shows that human leukocyte antigen (HLA) genes play a key role in the immune responses to sepsis. Nevertheless, the effects of HLA genes in sepsis have still not been comprehensively understood. Methods: A systematical search was performed in the Gene Expression Omnibus (GEO) and ArrayExpress databases from inception to 10 September 2021. Random forest (RF) and modified Lasso penalized regression were conducted to identify hub genes in multi-transcriptome data, thus we constructed a prediction model, namely the HLA classifier. ArrayExpress databases, as external validation, were utilized to evaluate its diagnostic, prognostic, and predictive performance. Immune cell infiltration score was calculated via CIBERSORTx tools and single-sample gene set enrichment analysis (ssGSEA). Gene set variation analysis (GSVA) and ssGSEA were conducted to determine the pathways that are significantly enriched in different subgroups. Next, we systematically correlated the HLA classifier with immunological characteristics from multiple perspectives, such as immune-related cell infiltration, pivotal molecular pathways, and cytokine expression. Finally, quantitative real-time polymerase chain reaction (qRT-PCR) was conducted to validate the expression level of HLA genes in clinical samples. Results: A total of nine datasets comprising 1,251 patients were included. Based on RF and modified Lasso penalized regression in multi-transcriptome datasets, five HLA genes (B2M, HLA-DQA1, HLA-DPA1, TAP1, and TAP2) were identified as hub genes, which were used to construct an HLA classifier. In the discovery cohort, the HLA classifier exhibited superior diagnostic value (AUC = 0.997) and performed better in predicting mortality (AUC = 0.716) than clinical characteristics or endotypes. Encouragingly, similar results were observed in the ArrayExpress databases. In the E-MTAB-7581 dataset, the use of hydrocortisone in the HLA high-risk subgroup (OR: 2.84, 95% CI 1.07–7.57, p = 0.037) was associated with increased risk of mortality, but not in the HLA low-risk subgroup. Additionally, immune infiltration analysis by CIBERSORTx and ssGSEA revealed that B cells, activated dendritic cells, NK cells, T helper cells, and infiltrating lymphocytes (ILs) were significantly richer in HLA low-risk phenotypes, while Tregs and myeloid-derived suppressor cells (MDSCs) were more abundant in HLA high-risk phenotypes. The HLA classifier was significantly negatively correlated with B cells, activated dendritic cells, NK cells, T helper cells, and ILs, yet was significantly positively correlated with Tregs and MDSCs. Subsequently, molecular pathways analysis uncovered that cytokine-cytokine receptor (CCR) interaction, human leukocyte antigen (HLA), and antigen-presenting cell (APC) co-stimulation were significantly enriched in HLA low-risk endotypes, which was significantly negatively correlated with the HLA classifier in multi-transcriptome data. Finally, the expression levels of several cytokines (IL-10, IFNG, TNF) were significantly different between the HLA subgroups, and the ratio of IL-10/TNF was significantly positively correlated with HLA score in multi-transcriptome data. Results of qRT-PCR validated the higher expression level of B2M as well as lower expression level of HLA-DQA1, HLA-DPA1, TAP1, and TAP2 in sepsis samples compared to control sample. Conclusion: Based on five HLA genes, a diagnostic and prognostic model, namely the HLA classifier, was established, which is closely correlated with responses to hydrocortisone and immunosuppression status and might facilitate personalized counseling for specific therapy.