You can have a script that forces an alliance (or neutrality) between two factions every turn, but the AI will still declare war, even if it's forces to stop the very next turn, and might keep on declaring war/having the war canceled again and again.
Without a script, you can use a command in descr_strat that goes like this:
Code:
ai_do_not_attack_faction faction1_name, faction2_name, etc
which makes the AI less likely (but still not impossible) to attack faction1 and faction2. This works only with Alex.exe though.