Charles County's top elected official was released today after serving 33 days of a sentence in the county detention center for a misdemeanor gambling conviction.

County Commissioners President Marland Deen was treated to a hero's welcome when he returned to the courthouse this morning to preside over a commissioners' meeting.

A cake inscribed with "Welcome Back, Ol' Man Deen" awaited him, and there was a spirited chorus of "For He's a Jolly Good Fellow" before the meeting.

Deen, 58, was sentenced April 5 to 60 days in jail after a Circuit Court jury found him guilty of one count of paying off on an illegal video "Joker Poker" machine that once operated in his country store in Waldorf, Md.

Deen's brother, Wayne, 47, who manages the store, was found not guilty at the same trial of 11 identical gambling charges.

The commissioner said the jail was the scene of a "major spraying and delousing campaign" during his incarceration when there was a threat of a body lice infestation among the inmates. Deen limped through his first day of official duties, saying he got a "bum knee" after falling down stairs while on mop duty at the detention center.

Deen said he would return to jail tomorrow to lunch with his former cellmates as a "show of solidarity" and he said he would press for speedier court dates for inmates he said were languishing unnecessarily in jail.

But today Deen was eager to put the whole experience behind him.

"Yesterday is over," he said. "I'm not interested in holding grudges and hell-raising on a podium. . . .It's time to get on with my job."

Although Deen has not decided whether to run again for county commissioner when his four-year term ends in 1986, few observers think his conviction will adversely affect the political fortunes of the popular Democrat.

Two weeks ago, Judge C. Clarke Raley reduced Deen's jail sentence by 27 days, but refused to expunge the conviction from Deen's record. Raley said the case was evidence of corruption in Charles County and he said the sentencing was needed to help purge the county of gambling influences.

Special deputy prosecutor Gerald C. Ruter had told the judge that to free Deen early would "abort the catharsis that had begun. There is an unsavory and unhealthy alliance between public officials in this county and people who are at best unscrupulous . . . . "

The Deen case, the last of 17 convictions following a six-month investigation by the state's attorney's office, riveted community attention on the gambling issue. Some longtime residents said that because gambling had been entrenched in Southern Maryland for decades, they thought the emphasis placed on the Deen case was uncalled for.

Between 1949 and 1968 slot machines were legal in the region and tourists flocking to the region to play the one-armed bandits contributed heavily to the area's prosperity.