Background: Immune-related genes (IRGs) play a crucial role in the initiation and progression of cholangiocarcinoma (CCA). However, immune signatures have rarely been used to predict prognosis of CCA. The aim of this study was to construct a novel model for CCA to predict survival based on IRGs expression data. Methods: The gene expression profiles and clinical data of CCA patients from The Cancer Genome Atlas (TCGA) and Gene Expression Omnibus (GEO) database were integrated to establish and validate prognostic IRG signatures. Differentially expressed immune-related genes were screened. Univariate and multivariate Cox analysis were performed to identify prognostic IRGs, and the risk model that predicts outcomes was constructed. Furthermore, receiver operating characteristic (ROC) and Kaplan-Meier curve were plotted to examine predictive accuracy of the model, and a nomogram was constructed based on IRGs signature, combining with other clinical characteristics. Finally, CIBERSORT was used to analyze the association of immune cells infiltration with risk score. Results: We identified that 223 IRGs were significantly dysregulated in patients with CCA, among which five IRGs (AVPR1B, CST4, TDGF1, RAET1E and IL9R) were identified as robust indicators for overall survival (OS), and a prognostic model was built based on the IRGs signature. Meanwhile, patients with high risk had worse OS in training and validation cohort, and the area under the ROC was 0.898 and 0.846, respectively. Nomogram demonstrated that immune risk score contributed much more points than other clinicopathological variables, with a C-index of 0.819 (95% CI, 0.727-0.911). Finally, we found that IRGs signature was positively correlated with the proportion of CD8+ T cells, neurophils and T gamma delta, while negatively with that of CD4+ memory resting T cells. Conclusions: We established and validated an effective five IRGs-based prediction model for CCA, which could accurately classify patients into groups with low and high risk of poor prognosis.