Colorectal cancer (CRC) is one of the most common malignant carcinomas worldwide with poor prognosis, imposing an increasingly heavy burden on patients. Previous experiments and epidemiological studies have shown that vitamin D and vitamin D-related genes play a vital role in CRC. Therefore, we aimed to construct a vitamin D-related gene signature to predict prognosis in CRC. The CRC data from The Cancer Genome Atlas (TCGA) was performed as the training set. A total of 173 vitamin D-related genes in the TCGA CRC dataset were screened, and 17 genes associated with CRC prognosis were identified from them. Then, a vitamin D-related gene signature consisting of those 17 genes was established by univariate and multivariate Cox analyses. Moreover, four external datasets (GSE17536, GSE103479, GSE39582, and GSE17537) were used as testing set to validate the stability of this signature. The high-risk group presented a significantly poorer overall survival than low-risk group in both of training set and testing sets. Besides, the areas under the curve (AUCs) for signature on OS in training set at 1, 3, and 5 years were 0.710, 0.708, 0.710 respectively. The AUCs of the ROC curve in GSE17536 for 1, 3, and 5 years were 0.649, 0.654, and 0.694. These results indicated the vitamin D-related gene signature model could effectively predict the survival status of CRC patients. This vitamin D-related gene signature was also correlated with TNM stage in CRC clinical parameters, and the higher risk score from this model was companied with higher clinical stage. Furthermore, the high accuracy of this prognostic signature was validated and confirmed by nomogram model. In conclusion, we have proposed a novel vitamin D-related gene model to predict the prognosis of CRC, which will help provide new therapeutic targets and act as potential prognostic biomarkers for CRC.