Objective Chronic kidney disease (CKD) is highly prevalent among people with diabetes. While identifying modifiable risk factors to prevent a decline in kidney function among those living with diabetes is pivotal, there is limited evidence on dietary risk factors for CKD. In this study, we examined the associations between healthy and less healthy plant-based diets (PBDs) and the risk of CKD among those with diabetes, and to identify potential underlying mechanisms. Methods We conducted a prospective analysis among 7,747 UK Biobank participants with prevalent diabetes. Multivariable Cox proportional hazard regression models were used to examine the associations between healthful and unhealthful PBDs and the risk of CKD. Causal mediation analyses were further employed to explore the underlying mechanisms of the observed associations. Results Among 7,747 study participants with diabetes, 1,030 developed incident CKD over 10.2 years of follow-up. Higher adherence to a healthy PBD was associated with a 24% lower CKD risk (HRQ4 versus Q1: 0.76 [95%CI: 0.63–0.92], p trend = 0.002), while higher adherence to an unhealthy PBD was associated with a 35% higher risk (HRQ4 versus Q1: 1.35 [95%CI: 1.11–1.65], p trend = 0.006). The observed associations were predominantly mediated by markers of body fatness (proportion mediated: 11–25%) and kidney function (23–89%). Conclusions In this prospective cohort study of middle-aged adults with diabetes, adherence to a healthy PBD was associated with lower CKD risk, whereas adherence to an unhealthy PBD was associated with a higher CKD risk. Associations were primarily mediated by markers of lower body fatness and improved kidney function.