Following the revision of the French dietary guidelines in 2017, the Programme National Nutrition Santé – guidelines score (PNNS-GS), built upon previous recommendations released in 2001, needed to be updated. This cross-sectional study thus aimed to develop and validate the PNNS-GS2, a predefined food-based dietary index based on the 2017-revised French nutritional guidelines. A total of 80 965 participants recruited among French adults (≥18 years old) in the NutriNet-Santé web-based prospective cohort were included. Collected data included repeated 24 h-dietary records over a 2-year period, sociodemographic and, for 16 938 subjects, clinical and biological data. Weighting and cut-offs of the PNNS-GS2 components were collegially arbitrated by nutrition experts who participated in the 2017 revision of the guidelines. Sociodemographic, nutritional and clinical and biological factors were investigated according to quintiles (Q) of PNNS-GS2 (theoretical ranging −17 to +13·5). Mean PNNS-GS2 was 2·1 (sd 3·1) in women and −0·3 (sd 3·6) in men. Higher PNNS-GS2 (higher adherence to 2017 dietary guidelines) was positively associated with (mean difference between Q5 and Q1 in women/men) age (+8·4/+4·7 years), education (+3·9/+7·4 % of university level), physical activity (+13·3/+3·5 % of ≥60 min/d) and non-smoking (+9·7/+13·7 %), and was negatively associated with mean blood pressure (−3·0/−2·8 mmHg), plasma LDL-cholesterol (−0·07/−0·06 g/l) and TAG (−0·10/−0·16 g/l) concentrations. Higher PNNS-GS2 was also associated with higher intake of favourable nutrients, e.g. n-3 PUFA (+0·2/+0·2 % of energy intake), fibres (+8·7/+10·7 g) and vitamin C (+36·6/+43·8 mg). Associations between PNNS-GS2 and sociodemographic and nutritional factors arguing for its validation are coherent. Further studies are needed to evaluate its association with mortality and morbidity.