The Virginia Supreme Court, in an unusual ruling, today forbade a Southside judge from ordering the early release from prison of two defendants convicted in one of the state's biggest marijuana smuggling cases.

Criticizing the judge's earlier release of three other codefendants, the court refused to order the freed men back to prison. "The time for challenging such releases . . . has passed," the court said.

Virginia State Attorney General J. Marshall Coleman had sought to have the three returned to custody and had attempted to make the judge's actions an issue in his race for governor. But the state's high court said Coleman, who argued the case before the justices, had "misconstrued the function" of a writ of prohibition he filed in an effort to have the judge overturned.

Coleman, a Republican, today hailed the decision as "an important milestone in Virginia justice . . . " and blasted his Democratic opponent, Lt. Gov. Charles S. Robb, as "badly out of step with the people of Virginia" on the issue.

"Nothing in this campaign year has been more disappointing or appalling than the attitudes of the Democratic leadership toward this case," Coleman said. He said he has ordered his staff to seek new ways to "bring these men, who in effect are fugitives, back into custody."

Robb press secretary George Stoddart said Robb considered it "highly inappropriate for a sitting, part-time attorney general" to attempt to politicize the case. He said Robb "wholeheartedly endorses the court's ruling because it advocates stronger sentencing for drug pushers."

Anthony Troy, a Richmond lawyer and former Democratic state attorney general who argued against Coleman in the case, today sought to minimize the decision as a "technical criminal procedure matter" with no broad policy impact. "If Coleman wants to make politics out of the case, he'll have to live with it," Troy said.

Troy said he had not talked with Cumberland County Circuit Judge John R. Snoddy, whose actions releasing the three defendants from prison were the focus of the controversy. Snoddy was unavailable for comment.

All five defendants originally received lengthy prison terms from Snoddy following guilty pleas in the 1978 case, in which 13,000 pounds of marijuana and $2 million in cash were seized by police. Later -- in what Coleman has branded "a secret system of justice" -- Snoddy ordered three of the men set free.

Larry Sherman, 31, of Durham, N.C., and David S. Taylor, 29, of Colorado, each sentenced to 10 years, served only six months and five-and-a-half months respectively before being freed by the judge. The third freed defendant, Daniel Curry Crowley, 35, of Florida, served 13 months of a total 17-year term.

Douglas Bogue, 29, the alleged ringleader, is still serving a 25-year sentence at a state correctional facility in Chesapeake. A second Florida man, William H. Syfrett, 31, was sentenced to 20 years with five suspended and is in custody in Goochland County.

Bogue's lawyer, Richmond attorney Michael Morchower, today called the Supreme Court's decision "a total miscarriage of justice. He (Bogue) is the finest young man I've represented in 12 years of practice. He's a model prisoner."

Asked how Bogue -- who will be eligible for parole in June 1984 -- took the news of today's decision, Morchower said: "Well, he's not jumping for joy."

Lawyers for all five men filed motions with Snoddy asking for a reduction of sentence shortly after their convictions in the little one-room courthouse in Cumberland, about 40 miles west of Richmond.

Snoddy later entered orders within the required 21 days indicating he was taking the motions under advisement. In the meantime, the defendants were committed to the state prison system.

Despite opinions by earlier Virginia attorneys general to the contrary, yesterday's high court decision held that Snoddy was wrong not to have stated explicitly in court documents that he was suspending imposition of the final sentence while the defense motions were pending.

In such cases, under Virginia law, prisoners should be held in local jails and not transferred to a state prison facility, the court said.

The court, however, rejected arguments by Troy that Snoddy's intention to vacate the final sentencing order was implicit in the judge's orders.

Coleman said today he and his staff had not yet decided how to pursue the three released smugglers, but added, "We're not going to rest until we get these people back in prison or exhaust the remedies available to us."

Both Coleman and Wyatt Durrette, the Republican candidate for attorney general, said the case demonstrates the need to adopt Coleman's proposals for uniform sentencing in the state, concepts that the Democratic state legislature has refused to adopt.

But Stoddart, the Robb spokesman, charged the case demonstrated instead that Coleman is "using the case to bolster his candidacy."