Please Try this:
Open Services using services.msc command.
Locate Microsoft Account sign-in Assistant Service and make sure it is Running, and have Automatic startup type.
If issue still persists, you can refer other suggestions in this fix:
https://www.kapilarya.com/fix-cant-sign-into-microsoft-account-in-windows-11-10
Let us know if this helps!
Note: Included link(s) in this reply refers to a non-Microsoft website. The page appears to be providing accurate, safe information. Watch out for ads on the site that may advertise products frequently classified as a PUP (Potentially Unwanted Products). Thoroughly research any product advertised on the site before you decide to download and install it.