The emergence of biomagnetism imaging has led to the development of ultrasensitive and compact spin-exchange relaxation-free (SERF) atomic magnetometers that promise high-resolution magnetocardiography (MCG) and magnetoencephalography (MEG). However, conventional optical components are not compatible with nanofabrication processes that enable the integration of atomic magnetometers on chips, especially for elliptically polarized laser-pumped SERF magnetometers with bulky optical systems. In this study, an elliptical-polarization pumping beam (at 795 nm) is achieved through a single-piece metasurface, which results in an SERF magnetometer with a high sensitivity reaching 10.61 fT/Hz1/2 by utilizing a 87Rb vapor cell with a 3 mm inner diameter. To achieve the optimum theoretical polarization, our design combines a computer-assisted optimization algorithm with an emerging metasurface design process. The metasurface is fabricated with 550 nm thick silicon-rich silicon nitride on a 2 × 2 cm2 SiO2 substrate and features a 22.17° ellipticity angle (a deviation from the target polarization of less than 2%) and more than 80% transmittance. This study provides a feasible approach for on-chip polarization control of future all-integrated atomic magnetometers, which will further pave the way for high-resolution biomagnetism imaging and portable atomic sensing applications.