Macbook restarts repeatedly while sleeping
if the issue persist in safe mode,  it means that is either an issue in the whole software or even a problem in the logic board.

to isolate the issue try the next steps:

Create a new user and set the computer to sleep, if issue is not reproduced you can migrate the data from one user to another.

if issue is reproduced and you have a time machine backup to date where everything is fine restore the backup to isolate the problem, if you do not have the backup , try removing the next file :  macintoshHD/library/preferences/powermanagement.plist and perform a PRAM

if you still have the problem, backup your files and erase and install

if you still have the problem, you will have to take it to service. if it is hardware it is normally the logic board the problem.

good luck