Pancreatic ductal adenocarcinoma (PDAC) is a malignant tumor with a specific tumor immune microenvironment (TIME). Therefore, investigating prognostic immune-related genes (IRGs) that are closely associated with TIME to predict PDAC clinical outcomes is necessary. In the present study, 459 samples of PDAC from the Genotype-Tissue Expression database, The Cancer Genome Atlas (TCGA), International Cancer Genome Consortium (ICGC) and Gene Expression Omnibus (GEO) were included and a survival-associated module was identified using weighted gene co-expression network analysis. Based on the Cox regression analysis and least absolute shrinkage and selection operator analysis, four IRGs (2′-5′-oligoadenylate synthetase 1, MET proto-oncogene, receptor tyrosine kinase, interleukin 1 receptor type 2 and interleukin 20 receptor subunit β) were included in the prognostic model to calculate the risk score (RS), and patients with PDAC were divided into high- and low-RS groups. Kaplan-Meier survival and receiver operating characteristic curve analyses demonstrated that the low-RS group had significantly improved survival conditions compared with the high-RS group in TCGA training set. The prognostic function of the model was also validated using ICGC and GEO cohorts. To investigate the mechanism of different overall survival between the high- and low-RS groups, the present study included Estimation of Stromal and Immune Cells in Malignant Tumor Tissues Using Expression Data and Cell Type Identification by Estimating Relative Subset of Known RNA Transcripts algorithms to investigate the state of the tumor microenvironment and immune infiltration inpatients in the cohort from TCGA. In summary, four genes associated with the TIME of PDAC were identified, which may provide a reference for clinical treatment. [ABSTRACT FROM AUTHOR]