We aimed to develop a macrophage signature for predicting clinical outcomes and immunotherapy benefits in cholangiocarcinoma. Macrophages are potent immune effector cells that can change phenotype in different environments to exert anti-tumor and anti-tumor functions. The role of macrophages in the prognosis and therapy benefits of cholangiocarcinoma was not fully clarified. The objective of this study is to develop a prognostic model for cholangiocarcinoma. The macrophage-related signature (MRS) was developed using 10 machine learning methods with TCGA, GSE89748 and GSE107943 datasets. Several indicators (TIDE score, TMB score and MATH score) and two immunotherapy datasets (IMvigor210 and GSE91061) were used to investigate the performance of MRS in predicting the benefits of immunotherapy. The Lasso + CoxBoost method's MRS was considered a robust and stable model that demonstrated good accuracy in predicting the clinical outcome of patients with cholangiocarcinoma; the AUC of the 2-, 3-, and 4-year ROC curves in the TCGA dataset were 0.965, 0.957, and 1.000. Moreover, MRS acted as an independent risk factor for the clinical outcome of cholangiocarcinoma cases. Cholangiocarcinoma cases with higher MRS scores are correlated with a higher TIDE score, higher tumor escape score, higher MATH score, and lower TMB score. Further analysis suggested high MRS score indicated a higher gene set score correlated with cancer-related hallmarks. With regard to cholangiocarcinoma, the current study created a machine learning-based MRS that served as an indication for forecasting the prognosis and therapeutic advantages of individual cases.