Sheikh Sâmî al-Mâjid
Al-Salâm `Alaykum wa Rahmah Allah wa Barakâtuh.
The hadîth that you mention is referring to the telling falsehoods about supposedly true events. This could be by changing the facts about something that actually took place or by imagining something that never took place and then telling others that it had actually occurred. The actual forbidden act is to tell others of false and untrue events.
However, if you imagine a story which is known to your readers or listeners to be ficticious , this is not the same as telling lies. This is only an expression of your imagination.
I hold the opinion that it is permissible for you to write comedy stories, particularly if you aim to use them to highlight moral behaviors and for other positive objectives.
Our Islamic nation is in need of intellectual and artistic activities that promote decent values. By doing so, you are in fact providing a lawful alternative to the bad and immoral messages that are so widespread in the arts these days.
Source: Islam Today