The present study aimed to investigate the relationship between dietary patterns and the risk of type 2 diabetes mellitus (T2DM) among Taiwanese individuals. Data were collected using a nationwide cohort study (2001–15) from the Triple-High Database. Dietary intake was assessed using the twenty-group food frequency questionnaire and used to calculate alternate Mediterranean diet (aMED) and Dietary Approaches to Stop Hypertension (DASH) scores. Principal component analysis (PCA) and partial least-squares (PLS) regression were used to derive dietary patterns, with incident T2DM as the outcome. Multivariable-adjusted hazard ratios and 95 % confidence intervals were calculated using time-dependent Cox proportional hazards (Cox PH) regression analysis, and subgroup analyses were performed. A total of 4705 participants were enrolled in the study, and 995 had newly developed T2DM during the median 5⋅28-year follow-up period (30⋅7 per 1000 person-years). Six dietary patterns were extracted (PCA: Western, prudent, dairy and plant-based; PLS: health-conscious, fish-vegetable and fruit-seafood). The highest aMED score quartile had a 25 % (hazard ratio 0⋅75; 95 % CI 0⋅61, 0⋅92; P = 0⋅039) lower risk of T2DM than the lowest quartile. This association remained significant after adjustment (adjusted hazard ratio 0⋅74; 95 % CI 0⋅60, 0⋅91; P = 0⋅010), and no effect modifier was found for aMED. The DASH scores, PCA and PLS dietary patterns were not significant after adjustment. In conclusion, high adherence to a MED-type dietary pattern by Taiwanese foods was associated with a lower risk of T2DM in the Taiwanese population, regardless of unhealthy lifestyle habits.