Limited research has reported the association between MTNR1B gene polymorphisms and ischemic stroke (IS), and there is insufficient evidence on whether adopting a healthy lifestyle can mitigate genetic risks in this context. This study aimed to investigate the associations between MTNR1B gene variants (rs10830963 and rs1387153) and IS, examining the potential effect of gene-lifestyle interactions on IS risk. Conducted in northern China, this family-based cohort study involved 5116 initially IS-free subjects. Genotype data for rs10830963 and rs1387153 in MTNR1B were collected. Eight modifiable lifestyle factors, including body mass index (BMI), smoking, alcohol consumption, dietary habits, physical activity, sedentary time, sleep duration, and chronotype, were considered in calculating healthy lifestyle scores. Multilevel Cox models were used to examine the associations between MTNR1B variants and IS. Participants carrying the rs10830963-G and rs1387153-T alleles exhibited an elevated IS risk. Each additional rs10830963-G allele and rs1387153-T allele increased the IS risk by 36% (HR = 1.36, 95%CI, 1.12-1.65) and 32% (HR = 1.32, 95%CI, 1.09-1.60), respectively. Participants were stratified into low, medium, and high healthy lifestyle score groups (1537, 2188, and 1391 participants, respectively). Genetic-lifestyle interactions were observed for rs10830963 and rs1387153 (p for interaction < 0.001). Notably, as the healthy lifestyle score increased, the effect of MTNR1B gene variants on IS risk diminished (p for trend < 0.001). This study underscores the association between the MTNR1B gene and IS, emphasizing that adherence to a healthy lifestyle can mitigate the genetic predisposition to IS.