President Reagan commuted the prison sentence of former Maryland governor Marvin Mandel yesterday, ordering him released Dec. 20 -- nearly five months before his term is scheduled to end.

The signing of the executive clemency order climaxed a long and arduous campaign by Mandel and his supporters to win freedom for the two-time chief executive of Maryland who was convicted in 1977 on political corruption charges. He will have served more than 19 months in a federal prison camp in Florida when his sentence ends.

"How do I feel? There are no words to describe it," an emotional Mandel exclaimed yesterday, his voice breaking during a hurried telephone conversation hours after getting the news. "No one can appreciate how I feel to know I'm going home and rejoining the family. It's too much to describe."

Attorney General William French Smith, who announced the commutation, said Mandel would be transferred today from the Eglin Air Force Base prison camp to a halfway house in the Baltimore-Annapolis area.

The president's action closely followed a Justice Department recommendation that was sent to the White House last week. Smith said Reagan's decision to commute the sentence of the former governor was based "primarily on the fact that Mandel, having received the same three-year sentence as three other codefendants, would have been required to serve nearly four months more than any of the others."

Smith said that would have created "an unwarranted disparity between Mandel and the others."

Of the six codefendants convicted of federal mail fraud and racketeering charges, Mandel was the only one still in prison yesterday.

The former governor learned of the commutation about 3:30 p.m. yesterday after leaving his prison cubicle to head for his night job in the recreation area. A voice on the loudspeaker ordered him to report instead to his counselor, who gave him two telephone messages. One was from Abe Pollin, owner of the Capital Centre and the Washington Bullets, who has worked for Mandel's release and was among the first to learn of the commutation.

"I was afraid to be hopeful," Mandel recalled of his thoughts as he headed for a telephone. "You don't know how living with hope and then having it dashed time and again can make you wary. So when I called I was hoping against hope."

Pollin, he said, told him the news. "I said, 'Abe, you don't know what this means to me.' "

That call was followed by one to his wife Jeanne, a conversation filled with elation and punctuated with tears, and then a conference call between Mandel, his wife, and his attorneys, Arnold Weiner and Bruce Bereano, in which he learned the details of the president's action.

In yesterday's action, Reagan also commuted the sentence of Mandel codefendant W. Dale Hess, who was transferred last Monday from a prison camp in Alabama to a halfway house in Baltimore. Hess will now also be released Dec. 20, about one month before his scheduled parole date.

The release date set for Mandel by the White House went slightly beyond the Justice recommendation, which had called for release Jan. 14. The date set by Reagan will allow Mandel to be home Dec. 20, the first night of Hanukah, a Jewish holiday which celebrates freedom. Administration sources said the White House acted with the holiday spirit in mind.

For Mandel, the clemency request was a last-ditch effort for early freedom. He had exhausted all other means for early release, having appealed all the way up to the U.S. Parole Commission. The commisson, however, set his release date for next May, in essence, forcing him to serve almost his entire term after allowing for days off he had earned through good behavior. The board's decision was vehemently protested by Mandel and his supporters, who asserted that the decision was "discriminatory."

Yesterday, the Justice Department said the commission had, in effect, "almost entirely denied a parole." The department noted that the commission decision appeared to disregard the sentencing judge's intent when he imposed a term on Mandel that provided for immediate parole eligibility.

Smith said the commutation had been recommended to Justice by the former prosecutors in the case, the director of the Bureau of Prisons and the department's own pardon attorney.

The campaign for executive clemency began last August, when Mandel attorneys Weiner and Bereano delivered their formal request to White House Counsel Fred Fielding. Yesterday, the lawyers said they felt after their talk with Fielding that Reagan was sympathetic.

Support was then enlisted from a wide variety of influential officeholders, including two of Reagan's closest friends in Congress, Sen. Paul Laxalt (R-Nev.) and Rep. Jack Kemp (R-N.Y.). Weiner said yesterday, after a phone conversation with Mandel, that the governor "had expressed his gratitude to all who had helped him through the ordeal."

And before hurrying off to his last shift on his prison job, the former governor said yesterday, "Emotionally, I'm still trying to absorb it all. I really appreciate what the president has done. I can never say how much."