Pretty much every PC in 2023 is still an IBM PC… well most of them at least that haven’t dropped the “legacy BIOS boot” option for “UEFI-only”.
You can install FreeDOS on any PC which supports legacy boot (or boot FreeDOS from USB). The hardware is still compatible, the processor still starts in 16bit real mode, all the IBM PC I/O devices are hardware-emulated by your chipset; timers, keyboard controllers, DMA controlers, interrupt controllers. And your nvidia/AMD/intel graphics card is still compatible at a hardware level with the original VGA, and provide VESA BIOS extensions calls for SVGA modes.
The only thing which isn’t compatible at the hardware level any more with 90s PC hardware, are sound cards. So you can’t test soundblaster code on modern hardware. But everything else should work fine.