Valheim does not support turning off raids. To turn off a raid you will need to use a modded version of the game.

The mod that you should install is NoRaid - it's available through Thunderstore and can be found here: https://thunderstore.io/c/valheim/p/MystroDev/NoRaid/

With ServerFlex, installing mods on your Valheim server is easy. In two clicks you'll be all setup.

Install NoRaid on your Valheim Server with two clicks.
  1. Head over to your Valheim server and select the Mods tab on the horizontal navigation.
  2. In the search box, type NoRaid.
  3. On the NoRaid item click Install Latest
  4. Click accept again on the pop up
  5. Wait for the mod to install
  6. Restart your server.

It's that simple! There will be no more raids on your server.