If there’s no other working account, you may need to use Windows recovery options (for example, “Reset this PC” while keeping your personal files, or a repair install using installation media) to regain access to the system and then link it to a new Microsoft account.
https://learn.microsoft.com/en-us/answers/questions/2337356/how-to-reset-windows-11-article