Serving as commander in chief is demanding.

But serving as comedian in chief can be demeaning.

Give President Barack Obama fair credit, though, for playing the latter part well Saturday night during a 17-minute stand-up routine at the annual White House Correspondents Dinner. Garbed in a tux and armed with edgy gags, he displayed skillful humor timing on such lines as:

¦ “I’ve tried to be civil and not take any cheap shots, and that’s why I want to thank all the members [of Congress] who took a break from their exhausting schedule of not passing any laws to be here tonight.”

¦ “It’s nice to be here in the nice, vast Hilton ballroom. Or as Mitt Romney would call it, a fixer-upper.”

The president even made light of the recent “news,” somehow finally noticed from a book he wrote long ago, that he dined on dog as a child while living in Indonesia. Amending one of Sarah Palin’s stock 2008 campaign lines, he quipped:

¦ “What’s the difference between a hockey mom and a pit bull? A pit bull is delicious.”

The spectacle again drew a star-studded crowd, including George Clooney, Reese Witherspoon, Rick Santorum, Charlize Theron, Rahm Emanuel, Lindsay Lohan, Chris Christie, Kim Kardashian and Colin Powell. The president and host Jimmy Kimmel, star of a late-night talk show on ABC, kept the attendees amused.

And while it can seem disrespectful of the office for presidents to make like Rodney Dangerfield, at least Mr. Obama didn’t reach as low for laughs as his White House predecessor did during the 2004 dinner.

That’s when George W. Bush showed photos of himself looking in vain under Oval Office furniture as he told the audience: “Those weapons of mass destruction have got to be somewhere. Nope, no weapons over there. Maybe under here?”

Hey, when Bill Maher says something in bad taste, as he does with unrelenting zeal, he can plead “comedian.”

Presidents lack that excuse. OK, so it’s nice for them to take occasional comic-relief breaks from their deadly serious jobs to poke a little fun at others — and themselves.

But if you doubt that presidential dignity has declined over the last several decades, try to picture Dwight D. Eisenhower doing a 17-minute standup routine.

And please, Mr. President, no more dog-eating jokes.