Disconnect all other external devices in case one of them is providing a slight charge to the laptop which perhaps is not being noted by macOS. Perhaps your power adapter or charging cable is not actually working. I have seen some reports where some of these M-series Macs are not charging with the MagSafe3 charging cable due to bad Logic Boards (I have personally seen this occur with at least one of my organization's M-series Macs), so try using a USB-C charging cable instead to compare results.
Also, here are three similar but slightly different Apple articles for troubleshooting charging issues:
If your USB-C power adapter isn't charging your Mac laptop - Apple Support
If your MagSafe cable or power adapter isn't working – Apple Support (UK)
If your Mac battery won’t charge - Apple Support
Make sure to connect the charging cable directly to the laptop and definitely try using another USB-C port especially on the other side of the laptop if possible. Also, unplug the power adapter from the electrical outlet for a minute in order to reset the power adapter's internal circuitry.
Try running the Apple Diagnostics to see if any hardware issues are detected.