I’m not sure which half of “Dragonfly” is worse: The part where nothing’s happening, or the part where something’s happening, but it’s stupid.

Kevin Costner, proving again that his good performances in the early ’90s were the exceptions and not the rule, plays emergency room doctor Joe Darrow. His wife, Emily, has just perished in a Venezuelan bus accident while doing humanitarian work, and now Joe cannot seem to get his life back in order.

Emily had a thing for dragonflies, and now Joe sees them everywhere. In fact, after the very first sign of a dragonfly, he begins to assume supernatural involvement — a leap of logic that would be out of place in a more sensible movie, but which seems quite reasonable in this sloppily written slab.

It gets worse for Joe, though: Emily’s former patients — kids with cancer — start having near-death experiences in which Emily tells them to send Joe a message. What is the message? Well, they’re not clear on that. Instead of just speaking her mind, dead Emily prefers to give cryptic clues and symbols, suggesting she does not want Joe to find spiritual enlightenment so much as she wants him to go on a scavenger hunt.

The script is by first-timers Brandon Camp and Mike Thompson, and by David Selzer, whose only significant credit is “The Omen,” (a movie whose faint, dim influence can be felt here). Its dialogue is leaden and awkward; I will cite one example. Joe tells a suicidal patient that her heart must want her to live, because it is beating very strongly. She says, tearfully, “No one knows my heart.” Joe replies, “Maybe that’s why it’s still beating — to give someone a chance to.”

There are also several instances in which a character’s profession is revealed through clumsy dialogue: “As an eye surgeon, I can tell you…”; “She’s a grief counselor”; “Emily was more than just a doctor”; “You’d think a professor of law would know…” (and, from the same character: “I’m a lawyer!”). Lazy, lazy writing.

Foreshadowing also is not the forte of Mssrs. Camp, Thompson and Selzer. Anytime something is mentioned that will be important later, you can count on it being mentioned over and over, to ensure we still remember it when it turns up again. The rafting trip! The pregnancy! The dragonfly! The number of times people sit around discussing Joe’s pet parrot in casual conversation, you’d think it was the reincarnated Dalai Lama.

The final sequence of events is ludicrous beyond all imagining. If Costner had acted with any level of competence, or if director Tom Shadyac (“Patch Adams,” “Ace Ventura: Pet Detective”) had exhibited any finesse or style, then the finale might be an emotional release for an audience wrapped up in the sorry plight of Dr. Joe Darrow. As it is, though, Joe is a nobody surrounded by nobodies who say nothing worthwhile, and the finale is just silly.

D+ (; PG-13, some mild profanity, pretty mild.)