We aimed to investigate the intricate interplay between genetic predisposition and lifestyle factors on stroke. We conducted a comprehensive genome-wide association study to identify the genetic variants linked to stroke in the participants who experienced a stroke event (cases; n 672) and those with no stroke history (non-stroke; n 58 029) in a large hospital-based cohort. Using generalised multifactor dimensionality reduction, we identified genetic variants with interactive effects and constructed polygenic risk scores (PRS) by summing up the risk alleles from the genetic variants. Food intake was measured with a validated semi-quantitative FFQ. No significant differences in stroke incidence were seen in demographic variables between the two groups. Among the metabolic indicators, only serum TAG levels were higher in males with stroke than those without stroke. The daily nutrient intake, dietary inflammation index, glycaemic index, dietary patterns, alcohol consumption, exercise and smoking did not display associations with the OR for stroke. The stroke-linked genetic variants were related to the IL-18 pathway. After accounting for covariates, the PRS derived from the 5-, 6- and 7-SNP models were positively associated with stroke chance with 2·5-, 2·9- and 2·8-fold. Furthermore, interactions between genetic predisposition and dietary components, including energy, carbohydrates, n-3 fatty acids and branched-chain amino acids (BCAA), that affected OR for stroke were observed. A high intake of energy, carbohydrates and BCAA and a low intake of n-3 fatty acids were positively associated with the chances of stroke occurrence. In conclusion, understanding the interaction between genetic variants and lifestyle factors can assist in developing stroke prevention and management strategies.