Background: This study investigates the relationships between folate intake, RBC folate, serum folate levels, and stroke risk, with an emphasis on the mediating roles of the dietary inflammatory index (DII) and systemic immune-inflammation index (SII). Methods: A cross-sectional analysis was conducted using 24,106 participants from NHANES (2007-2018). Associations were assessed with weighted multivariate logistic regression, adjusting for key confounders. Propensity score matching (PSM) was applied, yielding 1,838 matched participants, respectively. Nonlinear relationships were analyzed with restricted cubic splines, and mediation analysis was performed for DII and SII. Results: Post-PSM, folate intake in Q2 (252-350 mu g/day), Q3 (350-484 mu g/day), and Q4 (> 484 mu g/day) was significantly inversely associated with stroke risk (trend P < 0.05), with adjusted ORs of 0.62 (95 % CI: 0.45-0.85), 0.65 (95 % CI: 0.46-0.90), and 0.60 (95 % CI: 0.42-0.86), respectively. Serum folate levels in Q3 (37.0 - 54.8 nmol/L) were also protective (OR: 0.47, 95 % CI: 0.32-0.68, trend P < 0.05). Serum folate levels exhibited a biphasic effect, with the lowest stroke risk at 41.9 nmol/L before PSM and 43.3 nmol/L after PSM. Mediation analysis showed DII mediated 45.2 % of the relationship between folate intake and stroke risk (P = 0.018), while SII's mediation effect was minimal (0.412 %, P = 0.016). No significant interactions were observed between folate intake, serum folate and stratified variables (P > 0.05) after PSM. Conclusion: Higher folate intake lowers stroke risk, with DII playing a significant mediating role, while serum folate presents a biphasic risk pattern. Personalized dietary strategies addressing folate intake and inflammation may be crucial for stroke prevention.