This process is called a clean install, which is ironic as there's nothing particularly clean about it: Microsoft has enshittified Windows Setup.
Troubleshooting a problem computer requires patience, know-how, and a lot of trial and error. Booting your PC in a clean configuration can help automate the process ...