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:

  1. Open your Profile Options:
     

  2. Select the required modloader version:
     

  3. Click 'Done'.

  4. Relaunch the game.

That’s all it takes to ensure your mod runs correctly.