Objective To prospectively study the influence and difference of various dietary patterns on all-cause mortality in diabetes patients of different genders.Methods A total of 20 002 participants (3 737 patients with diabetes) from National Health and Nutrition Examination Survey (NHANES) were enrolled. The relationship between dietary quality score and all-cause mortality was analyzed with COX proportional hazards regression model, and whether other factors interact with dietary pattern scores was evaluated with the method of stratified analysis.Results During the median follow-up period of 74 months, there were 512 deaths recorded, with 311 males and 201 females. The adjusted risk ratios for high dietary quality are as follows: dietary inflammation index [male: hazard ratio(HR)= 1.22, P =0.084; female: HR= 1.00, P=0.818], mediterranean diet score (male:HR= 0.99, P=0.873; female:HR= 0.79, P =0.027), healthy diet index 2020 (male:HR= 1.00, P =0.956; female: HR= 0.83, P =0.046). The influence of diet score on the death risk of diabetes patients is independent, and no internal interaction between diet score and other variables was found.Conclusion In the population with diabetes, mediterranean diet and healthy diet index 2020 are associated with lower mortality risk in women, while no significant association is found in men.