Uneven and sloppily sentimental, “Life as We Know It” is still the best Katherine Heigl comedy since “Knocked Up.”

Credit her co-star, Josh Duhamel for that. As he has done in many a less worthy romantic comedy, he amplifies her charm. And she, in turn, brings out his sweet side. And credit the script, which gives her more to play than your average “Ugly Truth.”

“Life As We Know It” is about two seriously mismatched people — once hurled together on a disastrous blind date — suddenly bonded together for life when their mutual friends die and designate them as the people who will raise their infant daughter.

Messer (Duhamel) is a womanizing, motorcycle riding TV director for the NBA’s Atlanta Hawks. Holly (Heigl) likes her high heels HIGH and her life organized. She runs a hip bakery and is utterly devoted to her college pal, Alison (Christina Hendricks of “Mad Men”). Even though Alison was responsible for “the Messer debacle of 2007.”

That’s the blind date Alison set Holly up on with Messer, a pal of Alison’s beau, Peter (Hayes MacArthur). The date was a fiasco — entirely his doing, seeing as how he’s selfish, childish, boorish and rude. They spend the next couple of years meeting, awkwardly, at Alison and Peter’s wedding and assorted parties, including their daughter’s first birthday.

Then Alison and Peter die.

Director Greg Berlanti, who cut his teeth as a TV writer, show creator, producer and director, deftly turns this film on a dime a couple of times — giving us decent tear-jerking moments, beginning with the one where the two not-friends mourn the loss of this young couple with a baby.

Life as they know it has changed. The they-can’t-get-along comedy resumes, now with diaper jokes, projectile vomiting, drop-the-baby gags, that magical babysitter who knows how to calm children (“The baby whisperer.”) and such. These two people who haven’t committed, haven’t fully grown up, suddenly are given responsibilities by friends who are not there to see to it that they succeed.

Dirty diapers? “It’s like ‘Slumdog Millionaire’ in there!”

The unspeaking infant is a witness to the Holly-Messer bickering — “Hey Sophie, look. THAT’S what bitter looks like.”

Duhamel gets most of the funny lines, Heigl is assigned the job of carrying off the scenes with the most heart.

A few supporting players score. Josh Lucas is the new man Holly would prefer in her life. Melissa McCarthy kills as the plump, bossy, drawling neighbor (one of the few Southern accents in this Atlanta tale).

It lumbers along (they could cut 15 minutes) and the plot takes far too many predictable turns. But the weight of the material suits Heigl’s skills. She’s not the gorgeous romantic victim (“27 Dresses,””The Ugly Truth”). As in “Knocked Up,” a baby makes all the difference in the world.

And as uneven as it is, “Life as We Know It” still goes down like comic comfort food, especially for anybody who’s ever dealt with parenthood. A baby makes us grow up and changes our lives and as this film points out, that’s not just a diaper joke.