Background: MIGRAINE is a common disorder which affects quality of life. There has been an increasing interest for discovering the association of gastrointestinal (GI) disorders with MIGRAINE during past years. This study aims to evaluate the association of Helicobacter pylori contamination, gastroesophageal reflux disease (GERD), gastric ulcer (GU), and duodenal ulcer (DU) with MIGRAINE in patients who underwent upper GI endoscopy due to refractory dyspepsia. Materials and Methods: In this observational cross‑ sectional study, 341 dyspeptic patients who underwent upper GI endoscopy in Shahid Beheshti Hospital, Qom, Iran, included during 2016– 2018. A checklist was used for collecting demographics, symptoms, and results from endoscopy and H. pylori testing. Diagnosis of MIGRAINE was made according to the International Headache Society criteria in patients who had headache. Data were analyzed using Chi‑ square and independent samples t‑ tests in SPSS 16 (SPSS Inc., Chicago, IL, USA) with P < 0. 05 as significance level. Results: Among 341 patients, 141 (% 41. 3) were male and 200 (58. 7%) were female. 149 (43. 7%) patients were diagnosed with MIGRAINE, from which 48 (32. 2%) were male and 101 (67. 8%) were female. The observed difference in MIGRAINE prevalence among male and female was statistically significant (P = 0. 003). 198 (58. 06%) patients were H. pylori contaminated, among these 138 (69. 7%) suffered from MIGRAINE. Among 143 H. pylori‑ negative patients, there were 11 (7. 7%) MIGRAINEurs. The difference in the prevalence of MIGRAINE among H. pylori positive and negative patients was significant. H. pylori and GERD were associated with MIGRAINE with P < 0. 001. Patients with DU were more commonly suffering from MIGRAINE (P = 0. 001). The association in patients with GU was not statistically significant (P = 0. 863). Conclusion: MIGRAINE might be associated with GERD, H. pylori infection, and DU, and the treatment of the underlying GI disorder may control headaches.