If the game notifies you that a mod requires a certain Forge or Fabric version to run, you can easily set that version for your modpack/profile custom through the 'Profile Options':




Once you select the required modloader version, click 'Done' and launch the game again.

As simple as that!