Here’s a fact: The way to write edifying fiction is to write what is. Here’s another: The way to write bad fiction is to write what is edifying.
I just read a line by Flannery O’Connor in Mystery and Manners that explains why this is so: “what is written to edify usually ends by amusing.” The word “amusing” is what triggered the realization. Humor is often produced by incongruity, contradiction, and paradox. The fool is comic because man is not supposed to be foolish. The wise man is good for a platitude, the idiot for a laugh.
Writers get in a trap when they set out to write what is edifying and seek to avoid the failures, the falls, the disappointments, the crises, the impieties, the sins inherent to life. To the extent that these things are thought unedifying and thus inadequately represented in an effort to be edifying, the writer creates a tale that does’t square and so inadvertently creates a joke instead of a convincing or compelling story. And accidental jokes are only accidentally edifying. Usually they are merely, as O’Connor says, amusing.
It is far better to follow Montaigne’s approach: “I do not teach, I relate.” Tell a story, tell it well, and let it be edifying in and of itself. O’Connor again: “The artist has his hands full and does his duty if he attends to his art. He can safely leave evangelizing to the evangelists.” And the comedy to the comedians.