A higher dietary diversity score (DDS) and a lower energy-adjusted dietary inflammatory index (E-DII) may be associated with lower risks of type 2 diabetes (T2D) and mortality. This cohort study aimed to investigate the associations of DDS and E-DII with all-cause mortality, incidence of T2D, and mortality of T2D, as well as the joint effects of these two dietary factors. A total of 181,360 participants without all types of diabetes at baseline from the UK Biobank and 42,139 participants from the US NHANES were included. Cox proportional hazards models were used to assess the associations of DDS and E-DII with outcomes. In the UK Biobank data, 8338 deaths, 3416 incident T2D cases, and 353 T2D deaths occurred during a median follow-up of 12.5 years. In the US NHANES data, 6803 all-cause deaths and 248 T2D-specific deaths were recorded during a median follow-up of 9.6 years. We observed that higher DDS and lower E-DII were significantly associated with lower risks of total mortality and incident T2D. Compared with low DDS, the hazard ratios (HRs) and 95% confidence intervals (CIs) of high DDS were 0.69 (0.64, 0.74) for all-cause mortality, 0.79 (0.70, 0.88) for incident T2D in the UK Biobank, and 0.69 (0.61, 0.78) for all-cause mortality in the US NHANES. Compared with participants in tertile 3 of E-DII, those in tertile 1 had a lower risk of overall death [HR 0.86 (95% CI: 0.81, 0.91) in UK Biobank; 0.83 (0.77, 0.88) in US NHANES] and incident T2D [0.86 (0.79, 0.94)] in UK Biobank. No evidence was observed of the interactive effects of DDS and E-DII on either all-cause mortality or the incidence and mortality of T2D. There was no significant association found between any exposure and T2D mortality in this study. In conclusion, our results revealed that higher DDS and lower E-DII were associated with both total mortality and incident T2D in UK and US adults.