It was feast and famine in the race for governor of Maryland yesterday: Gov. William Donald Schaefer (D) picked up a major endorsement, while Republican William S. Shepard was forced into court to fend off an anxious campaign debtor.

Under a brisk fall sky with a crackling, clear stream as the backdrop, Schaefer yesterday basked in the endorsement of major state environmental groups that four years ago maligned him.

Far ahead in the polls, Schaefer said his newfound friendship with groups such as Clean Water Action and the League of Conservation Voters "is one of the most gratifying endorsements to me . . . . The environmentalists changed their mind" because of his support for new non-tidal wetland regulations and other major environmental programs.

Shepard's campaign, meanwhile, was forced into court by a Bethesda direct mail firm seeking to collect on a $15,300 bill left over from the Republican primary.

Odell, Roper & Associates Inc. had asked Montgomery County Circuit Court Judge L. Leonard Ruben to attach the bank accounts of the campaign, as well as Shepard's personal funds, to ensure payment.

Finance reports filed Friday indicate the Shepard campaign has raised $106,000 -- compared with Schaefer's $2.3 million -- and owes about $28,000.

"We fear the money will have been spent up to the Nov. 6 election," said Robert W. Cobb, the company's attorney. "After that date, there will be no money, and the campaign will not live up to its obligations."

The judge denied the motion. Harry Storm, attorney for Shepard, called the claim "outrageous" and presented a $5,000 check to show that the Shepard campaign recognizes the debt and intends to pay it.

Like old enemies patching up a feud, Schaefer and John Kabler, an activist with the group Clean Water Action, stood on the banks of the Gunpowder Falls River in Baltimore County. As recently as two years ago, Kabler was not even allowed into meetings with Schaefer.

Each said he felt the other had done his part to make the relationship better.

Schaefer conceded that pressure from environmentalists was important, and Kabler said the governor was not as bad as he thought he would be. "We were really hard on him," Kabler said. "People told us the governor will hate you and you will suffer forever . . . . We developed an excellent relationship."