We report on the first measurement of the direct CP-violating asymmetry (A) in the charmless decay B0→K0π0 at Belle II and an updated measurement of its branching fraction (B). We use a sample of electron-positron collisions collected in 2019 and 2020 at the Υ(4S) resonance and corresponding to 62.8fb−1 of integrated luminosity. We reconstruct and select about 50B0→KS0π0 candidates, and we measure AK0π0=−0.40−0.44+0.46(stat)±0.04(syst) and B(B0→K0π0)=[8.5−1.6+1.7(stat)±1.2(syst)]×10−6. This is the first measurement of CP violation in B0→K0π0 decays reported by Belle II. The results agree with previous determinations and show a detector performance comparable with the best Belle results.