Is it safe to erase entire SSD of M1 computer?
Yes, it’s safe. First, boot into recovery mode using this guide: https://eshop.macsales.com/blog/74502-boot-an-m1-mac-into-recovery-mode/
Then clear the disk using disk utility (under the utilities menu bar item), and finally, click reinstall MacOS Big Sur.
Disk utility in recovery mode doesn’t show the entire disk by default, so make sure to go into the view menu bar option and select show all devices.