There are several ways of rooting Samsung Z Fold 3 but the safest way to achieve root status is by flashing pre rooted ROM but so far there was an issue that camera did not work. This issue has now been fixed.
Also, keep in mind that this firmware is only for the Z Fold 3 variant F926B only. If you flash it on any other variant, it is highly likely that you will brick it.
This process also requires you to have knowledge of ADB. Follow these steps properly.
A) Unzip the 4 odin files from the zip provided here and connect phone to computer
B) load ODIN on PC and disable AUTO Reboot – Next load BL.tar in BL, AP.tar in AP, Stock CP in CP and Stock HOMECSC in CSC
C) Click start to flash the files – when completed, keeping phone connected to PC, press and hold power and volume down and as soon as the screen turns off, press and hold vol up and power UNTIL in TWRP
D) Head to the TWRP mount menu disable MTP
E) In case you do not have MAGISK.zip on your Samsung phone’s internal storage, copy app-debug.zip to your adb folder and then open a command window and first confirm adb is working by typing adb devices you should see your device listed and “recovery” next to the device in command window – this means adb is working – type adb push app-debug.zip /sdcard this should send the app-debug.zip to internal storage – or SD card if you prefer.
F) go to the TWRP flash menu and you should see the app-debug.zip, flash it to root your A12 device – this needs to be done everytime TWRP is flashed in Odin it seems
G) reboot to system from TWRP power menu
That is it – you have successfully rooted Fold 3.