If the game notifies you that a mod requires a specific Forge or Fabric version to run, you can set that version for your modpack/profile through the Profile Options:
Open your Profile Options:
Select the required modloader version:
Click 'Done'.
Relaunch the game.
That’s all it takes to ensure your mod runs correctly.