The Keyboard is USB and Directly Connected to the computer ?
Not Connected via a USB Hub ?
What happens when you type in the Computer Account Password ?
Does if given an Error message and if so what is the error Message ?
Have an M1 Mac Mini which, when first received, had Bug Sur and used a USB directly connect and presto - set it up and then paired my Apple Bluetooth Magic Keyboard 2 and all is good. Since then upgraded to Monterey 12.5 and not issues at all.
If the issue is that it does not recognize your Account Passwords >>
refer to link below
This is from respected Contributor @ Barney -15E
Restarting Setup Assistant to create Admi… - Apple Community