I had a similar issue years ago with a computer. Would start to boot up then shut down. I had to try powering it on a bunch of times before it would finally work.
Eventually I guessed overheating / temp might be the problem, managed to get into the bios and disable some setting for reading temps. After that it booted just fine. All temps were fine as far as I saw, and the PC worked for years after that. My best guess is some temperature sensor had failed on the motherboard and that triggered the overheat shutdown protection. I know I hadn't changed anything on the PC bios/hardware/etc that might have caused an issue, so must have just been some weird failure. Or maybe dust buildup near a sensor or something.