PURPOSE: We aimed to examine the association between dietary patterns and type 2 diabetes mellitus (T2DM) while considering the potential effect modification by metabolic phenotypes (metabotypes). Additionally, we aimed to explore the association between dietary scores and prediabetes. METHODS: A total of 1460 participants (11.8% with T2DM) from the cross-sectional population-based KORA FF4 study were included. Participants, classified into three metabotype subgroups, had both their FSAm-NPS dietary index (underpinning the Nutri-Score) and ultra-processed foods (UPF) intake (using NOVA classification) calculated. Glucose tolerance status was assessed via oral glucose tolerance tests (OGTT) in non-diabetic participants and was classified according to the American Diabetes Association criteria. Logistic regression models were used for both the overall and metabotype-stratified analyses of dietary scores' association with T2DM, and multinomial probit models for their association with prediabetes. RESULTS: Participants who had a diet with a higher FSAm-NPS dietary index (i.e., a lower diet quality) or a greater percentage of UPF consumption showed a positive association with T2DM. Stratified analyses demonstrated a strengthened association between UPF consumption and T2DM specifically in the metabolically most unfavorable metabotype (Odds Ratio, OR 1.92; 95% Confidence Interval, CI 1.35, 2.73). A diet with a higher FSAm-NPS dietary index was also positively associated with prediabetes (OR 1.19; 95% CI 1.04, 1.35). CONCLUSION: Our study suggests different associations between poorer diet quality and T2DM across individuals exhibiting diverse metabotypes, pointing to the option for stratified dietary interventions in diabetes prevention.