After months of waiting and wishing for some sign from the government on his bid for freedom, former Maryland governor Marvin Mandel responded with a mixture of hope and trepidation yesterday to the news that the Justice Department had recommended his early release from prison.

"It's good news," Mandel said during a telephone interview from the federal prison camp in Florida, where he is serving a three-year term. "But I hate to get my optimism up and have it dashed again."

Mandel is well aware that President Reagan has the final say on granting executive clemency, and that the Justice recommendation for a January release -- four months before his term is scheduled to end -- is only one element in the decision. The former governor also remembers quite clearly the dizzying four-year legal battle that saw him convicted, then apparently cleared, and finally imprisoned.

"I am hopeful it will all work out," Mandel said. "You can't help but feel encouragement. Being in a place like this, you're always looking for a straw to grasp, but you don't want to get too optimistic."

Mandel got the news of the recommendation yesterday morning from his wife, Jeanne, when he placed a call to Chic & Ruth's Delly, his old Annapolis haunt, to check on the health of restaurant owner Chic Levitt, who was undergoing surgery. Jeanne Mandel happened to be there. She took the phone and gave him the unexpected news.

"He said 'Are you sure?' " Jeanne Mandel later recalled. "Then he said, 'Oh my God, it's just unbelievable. Finally, finally, something is happening.' "

Mandel's attorneys filed the request for clemency with the White House last August, and since then it has been reviewed by the Justice Department's pardon attorney office and then the attorney general's office. Last week, the confidential Justice recommendation went to the White House.

The White House yesterday gave no indication of the status of Mandel's bid for clemency.

That bid represents Mandel's last-ditch effort for early release. The former governor, who has served more than 18 months at the federal prison camp at Eglin Air Force Base, has exhausted all other means for early release, having appealed for an earlier parole date all the way up the U.S. Parole Commission. That commission ordered last year that he remain in prison until next May 14, in essence serving almost his entire term.

The commission action prompted a well-orchestrated protest effort that culminated this fall with a petition to the White House supporting clemency that was signed by most members of the Maryland congressional delegation and a wide variety of influential Republicans.

Yesterday, at Chic & Ruth's Delly, many of the diners expressed hope that the recommendation meant that the still-popular Mandel would soon be back home, according to Teddy Levitt, son of the proprietor. "One man who always comes in and would cut the governor down with some remark, said yesterday, 'I really hope it's true. It getting ridiculous keeping him in prison so long,' " Levitt said.

State Del. William Cox (D-Harford), an old friend of Mandel's, was not surprised by that reaction. "Mandel is liked today by people who did not like him before because they think he's been shafted by the parole board," said Cox, who occasionally hears from the former governor in long-distance phone calls.

When Mandel calls they talk about everything from family to the 1982 Maryland gubernatorial race. "He's just interested in our thoughts," Cox said. "That's how Marvin's always been. "He gathers your thoughts, thinks about things and then feeds you his thoughts. I don't think the man would ever stay out of politics. His entire life has been politics."

Mandel, in a characteristically enigmatic response, said yesterday he has not decided yet what he will do when he is released from prison. "I have had plenty of thoughts about that, but this is no place to make a decision. You don't know from one minute to the next what is happening.

"I've had a number of people make recommendations," Mandel continued. "I have had some offers from people of jobs and employment. But I want to be away from the stress and strain of these circumstances before deciding."

Mandel, who earlier had worked in the prison laundry stenciling a numbers on sets of clothing for new inmates, said he now has a job in the recreation area -- issuing equipment for sports and planning activities such as ball games, races and racquet ball matches.

Mandel said he knew nothing of the Justice recommendation until he talked to his wife about 8 a.m. yesterday, and then called a friend who read him the newspaper account of the action.

"I was a little shocked, but then right after that, one of the employes here said he had seen something about it one TV," Mandel said.

"Now, I guess I just have to wait and hope."