Postrandomization biases may influence the estimate of efficacy of supplemental vitamin D in diabetes prevention trials. In the Vitamin D and Type 2 Diabetes (D2d) study, repeated measures of serum 25-hydroxyvitamin D [25(OH)D] level provided an opportunity to test whether intratrial vitamin D exposure affected diabetes risk and whether the effect was modified by trial assignment (vitamin D vs. placebo).The D2d study compared the effect of daily supplementation with 100 μg (4,000 units) of vitamin D3 versus placebo on new-onset diabetes in adults with prediabetes. Intratrial vitamin D exposure was calculated as the cumulative rolling mean of annual serum 25(OH)D measurements. Hazard ratios for diabetes among participants who had intratrial 25(OH)D levels of <50, 75-99, 100-124, and ≥125 nmol/L were compared with those with levels of 50-74 nmol/L (the range considered adequate by the National Academy of Medicine) in the entire cohort and by trial assignment.There was an interaction of trial assignment with intratrial 25(OH)D level in predicting diabetes risk (interaction P = 0.018). The hazard ratio for diabetes for an increase of 25 nmol/L in intratrial 25(OH)D level was 0.75 (95% CI 0.68-0.82) among those assigned to vitamin D and 0.90 (0.80-1.02) among those assigned to placebo. The hazard ratios for diabetes among participants treated with vitamin D who maintained intratrial 25(OH)D levels of 100-124 and ≥125 nmol/L were 0.48 (0.29-0.80) and 0.29 (0.17-0.50), respectively, compared with those who maintained a level of 50-74 nmol/L.Daily vitamin D supplementation to maintain a serum 25(OH)D level ≥100 nmol/L is a promising approach to reducing the risk of diabetes in adults with prediabetes.