Background: A healthy eating pattern characterized by a higher intake of healthy plant foods has been associated with a lower risk of premature mortality, but whether this applies to individuals with varying glycemic status remains unclear. Methods: This study included 4621 participants with diabetes and 8061 participants with prediabetes from the US National Health and Nutrition Examination Survey (2007-2016). Using the dietary data assessed by two 24 h dietary recalls, a healthful plant-based diet index (hPDI) and an unhealthful plant-based diet index (uPDI) were created based on 15 food groups and were assessed for their relationships with mortality risk. Results: Over a median follow-up of 7.2 years, there were 1021 deaths in diabetes and 896 deaths in prediabetes. A higher hPDI (highest vs. lowest quartile) was associated with a 41% (HR = 0.59, 95% CI: 0.49-0.72; P-trend < 0.001) lower risk of all-cause mortality in diabetes and a 31% (HR = 0.69, 95% CI: 0.55-0.85; P-trend < 0.001) lower risk in prediabetes. A higher uPDI was associated with an 88% (HR = 1.88, 95% CI: 1.55-2.28; P-trend < 0.001) higher risk of mortality in diabetes and a 63% (HR = 1.63, 95% CI: 1.33-1.99; P-trend < 0.001) higher risk in prediabetes. Mediation analysis suggested that C-reactive protein and γ-glutamine transaminase explained 6.0% to 10.9% of the relationships between hPDI or uPDI and all-cause mortality among participants with diabetes. Conclusions: For adults with diabetes as well as those with prediabetes, adhering to a plant-based diet rich in healthier plant foods is associated with a lower mortality risk, whereas a diet that incorporates less healthy plant foods is associated with a higher mortality risk.