Hello there MulliganStew68,
I understand you've noticed that your iMac seems to restart as it is in sleep mode, so let's see if we're able to offer some suggestions to resolve this.
To get started, be sure that you have the latest version of macOS installed on your iMac as it may have come preinstalled with macOS Monterey 12.0 as opposed to macOS Monterey 12.0.1. If you see that you need to update, be sure you have a recent backup of information. For help with either of these steps, check out the following resources:
Back up your Mac with Time Machine
Update macOS on Mac
Once you've confirmed that you're up to date, take a look at your Energy Saver preferences to see if any can be adjusted to prevent this from occurring. For assistance with these preferences, take a look at the following resource:
Change Energy Saver preferences on a Mac desktop computer
If there aren't any adjustments to be made, it may be best to Contact Apple Support to look into this in more detail.
Have a great day!