Magnetars are strongly magnetized, isolated neutron stars1-3 with magnetic fields up to around 1015 gauss, luminosities of approximately 1031-1036 ergs per second and rotation periods of about 0.3-12.0 s. Very energetic giant flares from galactic magnetars (peak luminosities of 1044-1047 ergs per second, lasting approximately 0.1 s) have been detected in hard X-rays and soft γ-rays4, and only one has been detected from outside our galaxy5. During such giant flares, quasi-periodic oscillations (QPOs) with low (less than 150 hertz) and high (greater than 500 hertz) frequencies have been observed6-9, but their statistical significance has been questioned10. High-frequency QPOs have been seen only during the tail phase of the flare9. Here we report the observation of two broad QPOs at approximately 2,132 hertz and 4,250 hertz in the main peak of a giant γ-ray flare11 in the direction of the NGC 253 galaxy12-17, disappearing after 3.5 milliseconds. The flare was detected on 15 April 2020 by the Atmosphere-Space Interactions Monitor instrument18,19 aboard the International Space Station, which was the only instrument that recorded the main burst phase (0.8-3.2 milliseconds) in the full energy range (50 × 103 to 40 × 106 electronvolts) without suffering from saturation effects such as deadtime and pile-up. Along with sudden spectral variations, these extremely high-frequency oscillations in the burst peak are a crucial component that will aid our understanding of magnetar giant flares.