We investigated the impact of mandatory school nutrition policy on diet quality of Canadian school children using a quasi-experimental study design. Using 24-h dietary recall data from the 2004 Canadian Community Health Survey (CCHS) Cycle 2.2 and 2015 CCHS - Nutrition, we constructed the Diet Quality Index (DQI). We used multivariable difference-in-differences regressions to quantify the DQI scores associated with school nutrition policy. We conducted stratified analyses by sex, school grade, household income, and food security status to gain additional insights into the impact of nutrition policy. We found that mandatory school nutrition policy was associated with an increased DQI score by 3.44 points (95% CI: 1.1, 5.8) during school-hours in intervention provinces relative to control provinces. DQI score was higher among males (3.8 points, 95% CI: 0.6, 7.1) than among females (2.9 points, 95% CI: -0.5, 6.3), and the score among students in elementary schools was higher (5.1 points, 95% CI: 2.3, 8.0) than that among high school students (0.4 points, 95% CI: -3.6, 4.5). We also found that DQI scores were higher for middle-high income and food secure households. Provincial mandatory school nutrition policy was associated with better diet quality among children and youth in Canada. Our findings suggest that other jurisdictions may consider implementing mandatory school nutrition policy.