Constant war can become very oppresive. That's why there is a need for a cowboy episode, or for a holodeck episode, some kind of diversion. It also shows that there are other things happening, not just war. It emmulates real life. There is probably also a good reason from production point of view to throw those episodes in. They make the war feel longer.