Meeting the Institute of Medicine (IOM) gestational weight gain (GWG) guidelines is associated with a reduced risk of adverse perinatal outcomes. Overall diet quality comprehensively assesses dietary components and accounts for interactions between them. While GWG is influenced by maternal diet, its association with overall diet quality-measured by various dietary quality indices-is not well-defined. We prospectively estimated the relationship between four established dietary quality indices and the risk of GWG rate above (excessive) or below (inadequate) IOM guidelines in a multi-racial and ethnic cohort of 2914 pregnant people from the Pregnancy Environment and Lifestyle Study (2014-2019). We assessed diet quality using the Healthy Eating Index 2010 (HEI-2010), alternate Mediterranean Diet (aMED), Dietary Approaches to Stop Hypertension (DASH), and Empirical Dietary Inflammatory Index (EDIP). Following the first trimester, 56% of the cohort had excessive GWG, and 14% had inadequate GWG. Poor diet quality (below the 75th percentile), measured by HEI-2010, was associated with a higher risk of excessive GWG in the second and third trimesters [RR = 1.03 (1.00, 1.06)]. Effect modification of this relationship by race and ethnicity and pre-pregnancy BMI was assessed. We found poor diet quality to be associated with elevated risk of excessive GWG among Black participants [RR = 1.14 (1.02, 1.28)] and White participants [RR 1.07 (1.01, 1.12)]. This was also the case for participants with pre-pregnancy BMI < 25.0 [RR 1.05 (1.00, 1.10)]. These results suggest that diet quality measured by the HEI-2010 is associated with excessive GWG, and the associations appear to be stronger among pregnant people without overweight or obesity and pregnant people who identify as Black or White race and ethnicity.