Flavonoids play essential roles in plant growth and development, enhancing stress resistance. Moreover, flavonoids are vital in maintaining human health. To develop flavonoid-rich sweet corn varieties by genetic intervention, understanding the genetic basis of variation in flavonoid content is necessary. In this study, regulatory genetic mechanism of content of six flavonoids [dihydrokaempferol (DIH), quercetin (QUE), apigenin (API), kaempferol (KAE), isoquercitrin (ISO), and naringenin (NAR)] in two environments (Zengcheng and Zhuhai) was investigated. Two populations were used: the introgression line (IL) population with 187 families constructed with the sweet corn inbred lines “HZ11” and “ZX127” and the recombinant inbred line (RIL) population with 197 families derived from the cross of two sweet corn inbred lines (K44 and F22). A total of 145 flavonoid-related quantitative trait loci (QTLs) were detected, which were distributed on 10 chromosomes (Chr) of sweet corn, with 33, 26, 27, 7, 11, and 41 QTLs for DIH, QUE, API, KAE, ISO, and NAR, respectively. The proportion of phenotypic variance explained by individual QTLs ranged from 0.24–16.03%. Among them, 11 flavonoid-related QTLs could be stably detected in two different environments. Six QTLs (qQUE2.1a, qAPI2.1a, qAPI4.1a, qISO2a, qNAR7.2a, and qNAR8a) were detected in the IL population in two environments and were evaluated using the best linear unbiased prediction (BLUP) method. Only one QTL in the RIL population, namely, qKAE1d, was the main QTL controlling KAE. Seven stable QTL clusters were detected on five different chromosomes, including 2, 2, 1, 1, and 1 on Chr 2, Chr 4, Chr 7, Chr 8, and Chr 9, respectively. This suggested that these clusters may be responsible for controlling flavonoid QTLs in sweet corn. These findings provided a basis for nutritional quality improvement using marker-assisted selection breeding and clarified the genetic mechanism of flavonoid content in sweet corn.