PC restarts 2 times before booting normally

I recently built a new PC, and this keeps happening. Whenever I turn the power supply switch on it will turn on automatically then restart 2 times. I always use the power switch to power on and to shut off after i have shut down the computer first because the power button doesn’t work when i click it. When i turn the power switch on, it will either power on Automatically or turn the motherboard on only and the power button only turns on the fans for as long as i press it, so I have to use the motherboard’s power button.

After it starts booting, the restarts ALWAYS follow this pattern. i will see the gigabyte screen then it will shut off. Then i will see the gigabyte screen and it will boot into bios to tell me that I have a setting on and asks if i want to keep it on (i forgot what its called). The computer will stay on until i press yes, then it restarts again. When it boots again it is garunteed to work, but if i boot into bios then it will tell me cmos has been cleared even though i didn’t do that. Changes I make to bios save until I shut off the computer with the power switch.

I have tried replacing the cmos battery, updating bios, changing bios settings, and doing a memory test on the ram. I know this issue isnt exclusive to a drive, because I’ve booted off of live CDs, USBs, HDDs, and my SSD and the problem has always happened, and I use windows and Linux. I only use Linux now though.

I use the eagle wifi 7 gigabyte motherboard, the i7 intel series 2 processor, the fractal mini pop air case, nvidia geforce rtx 5070 graphics card, 32 gigabytes of ram in 2 sticks (they are in the correct slots) and i forgot what brand of ram and ssd i use. But I also have a dvd writer connected to my case. I feel like it could be a power supply issue but I don’t know how to test if it is.