The mortality rate of oesophageal squamous cell carcinoma (ESCC) remains high, and conventional TNM systems cannot accurately predict its prognosis, thus necessitating a predictive model. In this study, a 17‐gene prognosis‐related gene signature (PRS) predictive model was constructed using the random survival forest algorithm as the optimal algorithm among 99 machine‐learning algorithm combinations based on data from 260 patients obtained from TCGA and GEO. The PRS model consistently outperformed other clinicopathological features and previously published signatures with superior prognostic accuracy, as evidenced by the receiver operating characteristic curve, C‐index and decision curve analysis in both training and validation cohorts. In the Cox regression analysis, PRS score was an independent adverse prognostic factor. The 17 genes of PRS were predominantly expressed in malignant cells by single‐cell RNA‐seq analysis via the TISCH2 database. They were involved in immunological and metabolic pathways according to GSEA and GSVA. The high‐risk group exhibited increased immune cell infiltration based on seven immunological algorithms, accompanied by a complex immune function status and elevated immune factor expression. Overall, the PRS model can serve as an excellent tool for overall survival prediction in ESCC and may facilitate individualized treatment strategies and predction of immunotherapy for patients with ESCC.