Initially it was a intended to be a drama, but as Kubrick started to work on the screenplay
he began to see the absurdity and humor in many of the scenes and decided to write instead a "nightmare comedy."
To quote Kubrick:
After all, what could be more absurd than the very idea of two mega-powers willing to wipe out all human life because of an accident, spiced up by political differeces that will seem as meaningless to people a hundred years from now as the theological conflicts of the Middle Ages appear to us today?
And it was at this point I decided to treat the story as a nightmare comedy. Following this approach, I found it never interfered with presenting well-reasoned arguments.
In culling the incongruous, it seemed to me to be less stylized and more realistic than any so-called serious, realistic treatment, which in fact is more stylized than life itself by its careful exclusion of the banal, the absurd, and the incongrous.
In the contect of impending world destruction, hypocrisy, misunderstanding, lechery, paranoia, ambition, euphemism, patrioism, heroism, and even reasonableness can evoke a grisly laugh.
Terry Southern was brought in
to punch up the humor and flesh out the comically grotesque characters