Endometrial cancer (EC) is the most common gynecologic malignancy with increasing incidence and mortality. The tumor immune microenvironment significantly impacts cancer prognosis. Weighted Gene Co-Expression Network Analysis (WGCNA) is a systems biology approach that analyzes gene expression data to uncover gene co-expression networks and functional modules. This study aimed to use WGCNA to develop a prognostic prediction model for EC based on immune cell infiltration, and to identify new potential therapeutic targets. WGCNA was performed using the Cancer Genome Atlas Uterine Corpus Endometrial Carcinoma dataset to identify hub modules associated with T-lymphocyte cell infiltration. Prognostic models were developed using LASSO regression based on genes in these hub modules. The Search Tool for the Retrieval of Interacting Genes/Proteins was used for protein–protein interaction network analysis of the hub module. Gene Set Variation Analysis identified differential gene enrichment analysis between high- and low-risk groups. The relationship between the model and microsatellite instability, tumor mutational burden, and immune cell infiltration was analyzed using The Cancer Genome Atlas data. The model’s correlation with chemotherapy and immunotherapy resistance was examined using the Genomics of Drug Sensitivity in Cancer and Cancer Immunome Atlas databases. Immunohistochemical staining of EC tissue microarrays was performed to analyze the relationship between the expression of key genes and immune infiltration. The green-yellow module was identified as a hub module, with 4 genes (ARPC1B, BATF, CCL2, and COTL1) linked to CD8+ T cell infiltration. The prognostic model constructed from these genes showed satisfactory predictive efficacy. Differentially expressed genes in high- and low-risk groups were enriched in tumor immunity-related pathways. The model correlated with EC-related phenotypes, indicating its potential to predict immunotherapeutic response. Basic leucine zipper activating transcription factor-like transcription factor(BATF) expression in EC tissues positively correlated with CD8+ T cell infiltration, suggesting BATF’s crucial role in EC development and antitumor immunity. The prognostic model comprising ARPC1B, BATF, CCL2, and COTL1 can effectively identify high-risk EC patients and predict their response to immunotherapy, demonstrating significant clinical potential. These genes are implicated in EC development and immune infiltration, with BATF emerging as a potential therapeutic target for EC.