Objective: To develop a prediction model for the risk of diabetic retinopathy (DR) in patients with newly diagnosed type 2 diabetes mellitus (T2DM). Methods: Patients with new diagnosis of T2DM recorded in Yinzhou Regional Health Information Platform between January 1, 2015 and December 31, 2022 were included in the study. The predictor variables were selected by using Lasso-Cox proportional hazards regression model. Cox proportional hazards regression models were used to establish the prediction model for the risk of DR. Bootstrap method (500 resamples) was used for internal validation, and the performance of the model was assessed by C-index, the receiver operating characteristic curve and area under the curve (AUC), and calibration curve. Results: The predictor variables included in the final model were age of T2DM onset, education level, fasting plasma glucose, glycated hemoglobin A1c, urinary albumin, estimated glomerular filtration rate, and history of lipid-lowering agent and angiotensin converting enzyme inhibitor uses. The C-index of the final model was 0.622, and the mean corrected C-index was 0.623 (95%CI: 0.607-0.634). The AUC values for predicting the risk of DR after 3, 5, and 7 years were 0.631, 0.620, and 0.624, respectively, with a high degree of overlap of the calibration curves with the ideal curves. Conclusion: In this study, a simple and practical risk prediction model for DR risk prediction was developed, which could be used as a reference for individualized DR screening and intervention in newly diagnosed T2DM patients.