Objective: Perinatal depression (PND) is a common yet undertreated complication during pregnancy, necessitating an exploration of dietary patterns as a potential preventive and management strategy for PND. This study investigates the correlation between anxiety and depression scores with various food components and nutrient intake in late pregnancy, aiming to provide evidence-based dietary recommendations for the prevention and treatment of PND. Methods: A total of 297 women in the advanced stage of pregnancy were evaluated using a dietary frequency questionnaire and screened for symptoms of anxiety and depression. The consumption of 12 food groups and nutrients was calculated, alongside the collection of biochemical blood indicators and obstetric clinical data. Results: 1.Unemployed pregnant women exhibited a significantly higher likelihood of experiencing anxiety (P < 0.05). Those without health insurance, unemployed, or with an educational attainment below university level had a significantly increased probability of depression (P < 0.05). 2.Employment status and education level were identified as influential factors in dietary patterns. 3.Pregnant women with high anxiety scores displayed a heightened rate of cesarean sections (P < 0.05). 4.Nut and seed intake showed a significant negative association with depression (P < 0.05, OR = 0.937). 5.Thiamine intake was significantly positively associated with anxiety (P < 0.05, OR = 3.707), whereas dietary fiber intake was significantly negatively associated with depression (P < 0.05, OR = 0.801). 6.Anxiety was found to be significantly positively associated with perinatal complications (P < 0.05, OR = 2.400) and strongly correlated with depression (P < 0.05, OR = 17.147). Conclusion: Special attention should be given to unemployed pregnant women, who lack health insurance, have lower educational attainment, or exhibit symptoms of anxiety. Early screening for perinatal psychological disorders is recommended for timely intervention. Dietary supplementation with nuts, seeds, and fiber, along with improved glucose metabolism, may help prevent and manage PND.