Though there is an option to turn off the Barbarians, some people still want to have them in the game. Barbarians, however, are annoying and a huge problem especially early game. They multiply rapidly and attack your units and cities which ruin the game. The solution for this is to tame them.
What To Do With The Barbarians?
As cited by Quevik on Steam community, who also made the guide about disabling the walls and increase AI production, there are two things you need to understand how the Barbarians spawn in the game. First, a new barbarian spawns every 15 turns on standard and 45 on a marathon. Second, a new barbarian will also spawn once they hit a certain amount of boldness. Boldness is earned when a barbarian kills a unit, pillages a tile, or a scout reports back a city location. There are two options to solve this problem.
Civilization 5 Style Barbarians Spawning
The first option is to have a Civilization 5 style Barbarians. This option will able them to spawn only due to turn time similar to Civ 5. To make this happen, navigate to C:program files(x86) steam) steamapps common sid meier's civilization VI baseassetsgameplaydata. Look for the file named "GlobalParameters" and make a backup. Edit the original file by opening it and changing all the numbers in the five lines to "0". The file should now read:
Guarded Goody Huts
The second option is to make guarded 40g-only goody huts. This will disable the spawn of the barbarians other than the scout and the defense troop. In addition, you can kill them for the gold. Note that you have to follow the steps in the first option if you want to activate this or else, you will still have to deal with the city-raiding Barbarians.
In the same location, search for the file name "Barbarians". Find the text ( TurnsToWarriorSpawn= ). You will find three separate phrases; the two are followed by number 15 while the other one is followed by 25. Change all those numbers to "200". The phrases should now read ( TurnsToWarriorSpawn=20 ).
Since you're making guarded goody huts, you can change their spearmen with warriors by searching for the phrase (DefenderTag="CLASS_ANTI_CAVALRY"), still in the file named "Barbarians," change "CLASS_ANTI_CAVALRY" to "CLASS_MELEE".
Save the file and you're good to go. Do not forget to make backups of the files in case of errors or you want to play the game with a default setting. You can also visit this guide on how to enable multiplayer in Civ 6.