Socioeconomic pressures, sex, and physical health status strongly influence the development of major depressive disorder (MDD) and mask other contributing factors in small cohorts. Resilient individuals overcome adversity without the onset of psychological symptoms, but resilience, as for susceptibility, has a complex and multifaceted molecular basis. The scale and depth of the UK Biobank affords an opportunity to identify resilience biomarkers in rigorously matched, at-risk individuals. Here, we evaluated whether blood metabolites could prospectively classify and indicate a biological basis for susceptibility or resilience to MDD. Using the UK Biobank, we employed random forests, a supervised, interpretable machine learning statistical method to determine the relative importance of sociodemographic, psychosocial, anthropometric, and physiological factors that govern the risk of prospective MDD onset (total n=15,710). We then used propensity scores to rigorously match individuals with a history of MDD (n=491) against a resilient subset of individuals without an MDD diagnosis (retrospectively or during follow-up; n=491) using an array of key social, demographic, and disease-associated drivers of depression risk. 381 blood metabolites and clinical chemistry variables and 4 urine metabolites were integrated to generate a multivariate random forest-based algorithm using 10-fold cross-validation to predict prospective MDD risk and resilience. In unmatched individuals, a first case of MDD, with a median time-to-diagnosis of 72 years, can be predicted using random forest classification probabilities with an area under the receiver operator characteristic curve (ROC AUC) of 0.89. Prospective resilience/susceptibility to MDD was then predicted with a ROC AUC of 0.72 (x˜= 3.2 years follow-up) and 0.68 (x˜= 7.2 years follow-up). Increased pyruvate was identified as a key biomarker of resilience to MDD and was validated retrospectively in the TwinsUK cohort. Blood metabolites prospectively associate with substantially reduced MDD risk. Therapeutic targeting of these metabolites may provide a framework for MDD risk stratification and reduction. New York Academy of Sciences' Interstellar Programme Award; Novo Fonden; Lincoln Kingsgate award; Clarendon Fund; Newton-Abraham studentship (University of Oxford). The funders had no role in the development of the present study.