BackgroundA dietary pattern (DP) may impact on cancer incidence more strongly than individual foods, but this association remains uncertain. Here, we aimed to broadly explore the associations of an obesity-related DP with overall and 19 site-specific cancers.MethodsThis study included 114,289 cancer-free participants with at least two dietary assessments. A total of 210 food items were classified into 47 food groups, and the mean amount of each food group was used in reduced-rank regression to derive the obesity-related DP. Cox regressions were conducted to explore the associations of the obesity-related DP with overall and 19 site-specific cancers. The parallel mediation model was constructed to quantify the mediating roles of potential mediators.ResultsDuring a median follow-up period of 9.4 years, 10,145 (8.9%) incident cancer cases were documented. The derived-DP was characterized by a higher intake of beer and cider, processed meat, high sugar beverages, red meat, and artificial sweetener, and a lower intake of fresh vegetables, olive oil, tea, and high fiber breakfast cereals. Observational analysis showed that a higher obesity-related DP Z-score was linearly associated with an increased risk of overall cancer (adjusted hazard ratio (HR) = 1.02, 95% CI: 1.01, 1.04 per 1-SD increase, correctedP< 0.001). For site-specific cancer, positive linear associations for six cancer sites (oral, colorectal, liver, lung, endometrium, and thyroid) and nonlinear associations for six cancer sites (esophagus, malignant melanoma, prostate, kidney, bladder, and multiple myeloma) were observed. The paralleled mediation analysis suggested that the association between the obesity-related DP and overall cancer is mediated by the body mass index (BMI), the waist-to-hip ratio (WHR), C-reactive protein, high-density lipoproteins (HDLs), and triglycerides.ConclusionsThe developed obesity-related DP is strongly associated with overall and multiple cancer sites. Our findings highlight the complicated and diverse associations between an obesity-related DP and cancers and provide clues for future research directions.Supplementary InformationThe online version contains supplementary material available at 10.1186/s12916-023-02955-y.