First check if the Ram is fine. Follow instructions on how to run Memtest86
https://www.tomshardware.com/how-to/how-to-test-ram
If Ram isn't the problem, then check if the Bios is running fine or if it crashes. If not, then maybe you should try to reinstall Windows and see if that fixes it...