Growing evidence indicates a link between diet and depression risk. We aimed to examine the association between an inflammatory diet index and depression utilising extensive data from UK biobank cohort. The energy-adjusted dietary inflammation index (E-DII) was calculated to quantify the potential of daily diet, with twenty-seven food parameters utilised. The E-DII scores were classified into two categories (low v. high) based on median value. To mitigate bias and ensure comparability of participant characteristics, propensity score matching was employed. To ascertain the robustness of these associations, sensitivity analyses were conducted. Subgroup analyses were performed to evaluate the consistency of these associations within different subpopulations. Totally, 152 853 participants entered the primary analyses with a mean age of 56·11 (sd 7·98) years. Employing both univariate and multivariate logistic regression models, adjustments were made for varying degrees of confounding factors (socio-demographics, lifestyle factors, common chronic medical conditions including type 2 diabetes and hypertension). Results consistently revealed a noteworthy positive correlation between E-DII and depression. In the context of propensity score matching, participants displaying higher E-DII scores exhibited an increased likelihood of experiencing incident depression (OR = 1·12, 95 % CI: 1·05, 1·19; P = 0·000316). Subgroup analysis results demonstrated variations in these associations across diverse subpopulations. The E-value for the point-estimate OR calculated from the propensity score matching dataset was 1·48. Excluding individuals diagnosed with type 2 diabetes or hypertension, the findings consistently aligned with the positive association in the primary analysis. These findings suggested that consumption of a diet with higher pro-inflammatory potential might associated with an increase of future depression risk.