ObjectiveTo explore the relationship between 35 trace metals in scalp hair and the glioma risk as well as the potential mediating roles of 27 plasma inflammatory cytokines.MethodsA case–control study involving 228 participants was performed in southeastern China. Trace metals in scalp hair were analyzed using inductively coupled plasma mass spectrometry, and multiplex cytokines were detected based on Luminex® technology. The least absolute shrinkage and selection operator (LASSO) regression in combination with four machine learning methods were used to select trace metals associated with gliomas. The joint exposure effect of trace metals was estimated using the generalized weighted quantile sum (gWQS) regression and quantile‐based g‐computation (qgcomp) algorithms.ResultsBoth LASSO regression and random forest algorithms identified five trace metals (gadolinium [Gd], lithium [Li], thulium [Tm], thorium [Th], and molybdenum [Mo]) associated with gliomas. After adjustments for potential confounders, Gd (odds ratio [OR] = 2.84, 95% confidence interval [CI]: 1.89–4.43) and Li (OR = 1.77, 95% CI: 1.04–3.02) concentrations were positively associated with glioma risk, while Tm (OR = 0.36, 95% CI: 0.17–0.73) and Th (OR = 0.45, 95% CI: 0.28–0.71) exhibited inverse associations. Both gWQS and qgcomp algorithms showed Gd contributed most to the mixture effect. Moreover, there was a significant interaction between Gd and Tm or Th on glioma risk (p < 0.05). Notably, granulocyte–macrophage colony‐stimulating factor (GM‐CSF) mediated the association between Gd exposure and glioma risk by 25.75%.InterpretationThese findings suggest potential associations of certain trace metals, especially for Gd, with glioma risk, and may provide new insights into the mechanisms underlying from an inflammatory response perspective.