ObjectiveThe important contribution of dietary triggers to migraine pathogenesis has been recognized. However, the potential causal roles of many dietary habits on the risk of migraine in the whole population are still under debate. The objective of this study was to determine the potential causal association between dietary habits and the risk of migraine (and its subtypes) development, as well as the possible mediator roles of migraine risk factors.MethodsBased on summary statistics from large-scale genome-wide association studies, we conducted two-sample Mendelian randomization (MR) and bidirectional MR to investigate the potential causal associations between 83 dietary habits and migraine and its subtypes, and network MR was performed to explore the possible mediator roles of 8 migraine risk factors.ResultsAfter correcting for multiple testing, we found evidence for associations of genetically predicted coffee, cheese, oily fish, alcohol (red wine), raw vegetables, muesli, and wholemeal/wholegrain bread intake with decreased risk of migraine, those odds ratios ranged from 0.78 (95% CI: 0.63–0.95) for overall cheese intake to 0.61 (95% CI: 0.47–0.80) for drinks usually with meals among current drinkers (yes + it varies vs. no); while white bread, cornflakes/frosties, and poultry intake were positively associated with the risk of migraine. Additionally, genetic liability to white bread, wholemeal/wholegrain bread, muesli, alcohol (red wine), cheese, and oily fish intake were associated with a higher risk of insomnia and (or) major depression disorder (MDD), each of them may act as a mediator in the pathway from several dietary habits to migraine. Finally, we found evidence of a negative association between genetically predicted migraine and drinking types, and positive association between migraine and cups of tea per day.SignificanceOur study provides evidence about association between dietary habits and the risk of migraine and demonstrates that some associations are partly mediated through one or both insomnia and MDD. These results provide new insights for further nutritional interventions for migraine prevention.