A large UK Biobank study linked ultra-processed food (UPF) consumption to increased risks of anxiety, depression, substance use disorder, and other mental health outcomes. A metabolomic signature associated with UPF intake partially mediated these relationships, especially in adults under 60.