BackgroundTumor-infiltrating immune cells (TIICs) are associated with chemotherapy response. This study aimed to explore the prognostic value of a TIIC-related tumor microenvironment score (TMEscore) in patients with colorectal cancer (CRC) who underwent chemotherapy and construct a TMEscore-related gene signature to determine its predictive value.MethodsGene profiles of patients who underwent fluoropyrimidine-based chemotherapy were collected, and their TIIC fractions were calculated and clustered. Differentially expressed genes (DEGs) between clusters were used to calculate the TMEscore. The association between the TMEscore, chemotherapy response, and survival rate was analyzed. Machine learning methods were used to identify key TMEscore-related genes, and a gene signature was constructed to verify the predictive value.ResultsTwo clusters based on the TIIC fraction were identified, and the TMEscore was calculated based on the DEGs of the two clusters. The TMEscore was higher in patients who responded to chemotherapy than in those who did not, and was associated with the survival rate of patients who underwent chemotherapy. Three machine learning methods, support vector machine (SVM), decision tree (DT), and Extreme Gradient Boosting (XGBoost), identified three TMEscore-related genes (ADH1C, SLC26A2, and NANS) associated with the response to chemotherapy. A TMEscore-related gene signature was constructed, and three external cohorts validated that the gene signature could predict the response to chemotherapy. Five datasets and clinical samples showed that the expression of the three TMEscore-related genes was increased in tumor tissues compared to those in control tissues.ConclusionsThe TIIC-based TMEscore was associated with the survival of CRC patients who underwent fluoropyrimidine-based chemotherapy, and predicted the response to chemotherapy. The TMEscore-related gene signature had a better predictive value for response to chemotherapy than for survival.