Looks like one of the RAM sticks is faulty and needs replacement, but the solution may be simpler.
You did not specify the exact motherboard model so I had to look up all 11 MSI B350 models - all have one PS/2 port and 2 USB ports just below it.
First let's think this simple.
You are thinking that BIOS screen freezes - I had that issue as well - but actually what happens is that BIOS stops responding to keyboard and/or mouse input. So, BIOS may be still working correctly but can not detect keyboard and mouse anymore ( it happens, believe me )
When I connected a secondary USB mouse to another USB port, that mouse was working most of the time, but the original keyboard and mouse were not. Sometimes original keyboard and mouse were not working, but another set of USB keyboard and mouse that were connected to different USB ports were working.
So question is : what type are your keyboard and mouse? If one or two of them are USB, are they connected to the correct USB ports ? In this age, most motherboards have two USB 2.0 ports in the back panel just for this purpose - on MSI B350 these are the ones that are located just below the PS/2 port.
Also, if you use a Y type PS/2-to-USB cable to connect your PS/2 keyboard mouse to USB port, make sure you definitely connect that Y cable to these ports. If this is the case, then the problem is that you need to replace the Y cable. I have to use these Y cables due reasons long to discuss here, but each computer has its own preference when it comes to these Y cables. Soem computers work reliably with 1-2 dollar no-name and crap cables, some require higher quality cables but some ( like my Gigabyte AX370- Gaming 5 ) absolutely require the most expensive Digitus brand PS/2-to-USB cable and it requires it to be connected to the correct USB ports. After using this Digitus cable on correct port, ı have never experienced any "freezes" anymore. A cheaper cable and other ports ? Still freezes. So, if Y cable is used, that working on another computer does not mean it will work on this computer.
The correct diagnosis requires you to connect a PS/2 keyboard or mouse to PS/2 port ( keyboard is better for initial set up ) and see if BIOS still freezes. If not, then problem is not BIOS freezeing but simply keyboard mouse inputs being not responding.
Let's assume it still freezes. Then do a clear CMOS first, then enter BIOS and move quickly to Save/Exit section, set BIOS to boot with recommended/default settings, save and exit, and restart the computer. Then see if it still freezes. If not freezes, then quickly move to Integrated Peripherals, USB settings and make sure you have enabled Legacy USB devices and other settings that are relevant for USB keyboard and mouse.
If you can not find a PS/2 keyboard, first make sure you connect your keyboard and mouse to the correct ports I mention above. Then do a Clear CMOS and proceed as above.
If all else fails, try attaching a second USB keyboard etc and see what happens.