Diffuse large B-cell lymphoma (DLBCL) is the most common lymphoma in adults. This study aimed to determine the prognostic significance of endoplasmic reticulum (ER) stress-related genes in DLBCL. ER stress-related genes were obtained from the molecular signatures database. Gene expression data and clinical outcomes from the gene expression omnibus and TCGA datasets were collected, and differentially expressed genes (DEGs) were screened out. Gene ontology enrichment analysis, the kyoto encyclopaedia of genes and genomes pathway analysis, and geneset enrichment analysis were used to analyse the possible biological function of ER stress-related DEGs in DLBCL. Protein–protein interaction network construction using the STRING online and hub genes were identified by cytoHubba on Cytoscape software. The significant prognosis-related genes were screened, and the differential expression was validated. The immune microenvironment assessment of significant genes were evaluated. Next, the nomogram was built using univariate and multivariate Cox regression analysis. 26 ER stress-related DEGs were screened. Functional enrichment analysis showed them to be involved in the regulation of the endoplasmic reticulum mainly. NUPR1 and TRIB3 were identified as the most significant prognostic-related genes by comparison with the GSE10846, GSE11318, and TCGA datasets. NUPR1 was correlated with a good prognosis and immune infiltration in DLBCL; on the other hand, high expression of TRIB3 significantly correlated with a poor prognosis, which was an independent prognostic factor for DLBCL. In summary, we identified NUPR1 and TRIB3 as critical ER stress-related genes in DLBCL. NUPR1 might be involved in immune infiltration in DLBCL, and TRIB3 might serve as a potential therapeutic target and prognostic factor in DLBCL.