Background: Cardiopulmonary exercise test (CPET )is currently used to quantify functional limitation and to evaluate the indications for surgery among patients with hypertrophic cardiomyopathy (HCM). Patients with HCM often have atrial fibrillation (AF) and their relationship is not clear. Objective: To investigate the function limitation among HCM patients who meet indications for septal myectomy and the association between it and AF. Method: We reviewed 565 consecutive patients who underwent myectomy from February 2019 to October 2021, of which 212 did CPET and 24h Holter before surgery. Results: In this cohort (median age: 50.55(37.6-58) years; male: 126(59.4%); left ventricular outflow tract gradient (LVOTG)≥ 50 mmHg: 190(89.6%)), there was a severely impaired function (Peak Oxygen consumption (Peak VO2): 16.44 ± 4.02 ml/min/kg, adjusted Peak VO2%: 58.27%). Comparing different groups divided by Peak VO2, the lowest group was characterized by older age (58 vs 50 vs 43.9 years, p < 0.001), more female patients (57.7% vs 38% vs 25.7%, p < 0.001), higher NT-proBNP level (1299 pg/ml vs 1049 pg/ml vs 742.5 pg/ml, p = 0.004), and larger left atrial diameter (46.8mm vs 43.77 mm vs 42.71 mm, p < 0.001). The incidence of AF also significantly increased (30.98% vs 14.08% vs 7.14%, p < 0.001). Among various indicators of CPET, Peak VO2 showed the strongest correlation with AF (point-biserial correlation coefficient: -0.347, p < 0.001; 0.2279, p = 0.011; -0.2502, p < 0.001; for Peak VO2, ventilatory efficiency, and anaerobic threshold, respectively). Additionally, the incidence of AF decreased with increasing severity of obstruction (60% vs 33.3% vs 16.2% vs 7.1% among non-obstructive, 30≥maximum LVOTG < 50 mmHg, 50≥LVOTG < 100 mmHg, >100 mmHg patients, respectively, p = 0.001). In multivariate regression analysis adjusting for age, sex, BMI, and left atrial diameter, Peak VO2 and LVOTG remained independently associated with the development of AF (OR 0.854, 95% CI 0.743-0.973, p = 0.021 and OR 0.969, 95% CI 0.949-0.987, p = 0.002, respectively). Conclusions: CPET indicator, particularly PeakVO2, was independently associated with the occurrence of AF in eligible surgical patients with HCM. We also found that the higher extent of obstruction, the lower the incidence of AF.