Previous studies have shown an increased risk for atrial fibrillation and atrial flutter (AF) in people with type 2 diabetes and prediabetes. It is unclear whether this increase in AF risk is independent of other risk factors for AF. To investigate the association between diabetes and different prediabetic states, as independent risk factors for the onset of AF. We performed a population-based cohort study in Northern Sweden, including data on fasting plasma glucose, oral glucose tolerance test, major cardiovascular risk factors, medical history, and lifestyle factors. Participants were divided into six groups depending on glycemic status and followed through national registers for AF diagnosis. Cox proportional hazard model was used to assess the association between glycemic status and AF, using normoglycemia as reference. The cohort consisted of 88,889 participants who underwent a total of 139,661 health examinations. In the model adjusted for age and sex, there was a significant association between glycemic status and development of AF in all groups except the impaired glucose tolerance group, with the strongest association for the group with known diabetes (p-value <0.001). In a model adjusted for sex, age, systolic blood pressure, body mass index, antihypertensive drugs, cholesterol, alcohol, smoking, education level, marital status, and physical activity, there was no significant association between glycemic status and AF. The association between glycemic status and AF disappears upon adjustment for potential confounders. Diabetes and prediabetes do not appear to be independent risk factors for AF.