Dispositional optimism is a psychological trait that has been associated with health issues such as cardiovascular disease. However, there is little knowledge on the relationship between optimism and dietary intake in the general population. The objective of this cross-sectional study was to assess whether optimism was associated with diet quality, food group consumption and snacking. In 2016, 32,806 adult participants from the NutriNet-Santé study completed the Life-Orientation Test Revised (LOT-R) which assesses dispositional optimism. Diet quality (N = 17,849) and food group consumption (N = 19,335) were evaluated using at least three self-reported 24-h dietary records, while snacking behavior was evaluated by an ad-hoc question (N = 28,948). Logistic and linear regressions were used to analyze the associations between optimism and diet quality, food group consumption, and snacking behavior taking into account socio-demographic, lifestyle and depressive symptomatology characteristics. Optimism was positively associated with diet quality (b (95% CI) = 0.07 (0.004–0.11), P < 0.0001), while no association with energy was observed. Optimism was positively associated with consumption of fruit and vegetables, seafood, whole-grain food, fats, dairy product and meat substitutes, legumes, appetizers, non-salted oleaginous fruits and alcoholic beverages, and negatively associated with consumption of meat and poultry, dairy products, milk-based desserts and sugars and confectionery. In addition, optimism was negatively associated with snacking (OR (95% CI) = 0.89 (0.84, 0.95). Optimism was associated with a better diet quality overall and less snacking. It was also associated with consumption of healthy food groups as well as unhealthy food groups typically consumed at social eating occasions. These findings suggest that optimism could be taken into account in the promotion of a healthy eating behavior.