Mitch Snyder was restless and frustrated as he sat in Judge Charles R. Richey's courtroom. The leader of the Community for Creative Non-Violence had brought a lawsuit against President Reagan for breaking a promise to make a Washington shelter for the homeless a model for the country, and things were going in circles.

The judge had, for more than an hour, been thrashing about -- one minute deploring the closing of the shelter, the next agonizing over the legal weight of a presidential promise. Thinking out loud, as he said, he agreed with the government that the District of Columbia should take over the problem -- and agreed with the plaintiff that it showed not the slightest inclination to do so.

CCNV's lawyer, Peter Nichols, plainly pained His Honor by hammering on the sharp point that if the administration makes good on its threat to close the shelter on Aug. 31, there will be no place for the 600 people who sleep there on these steamy August nights to go.

"I am not a government policy- maker," said Richey, a protege of Spiro T. Agnew and an appointee of Richard M. Nixon who seemed to blanch at the idea of embarrassing a president. On the other hand, he said he had felt "a tinge of sorrow" when he saw a group of homeless people standing around drinking liquor on the street the other night, and he thinks the capital should be ashamed of the plight of its homeless.

Several times he noted plaintively that he had spent an entire weekend reading the voluminous papers in the case. But the two attorneys were not helping him in his dilemma, which seemed to grow as the arguments ground on.

Other people, when fed up, tend to grit their teeth, but not Snyder. He has a pirate's face and a politician's cunning, and he has never hesitated to make scenes. Usually, they take the form of hunger strikes.

On Nov. 3, two days before the election, Reagan said "uncle" to him. Health and Human Services Secretary Margaret M. Heckler, "speaking for the president from the White House," called Snyder, then in the 50th day of a hunger strike over the administration's refusal to renovate the dilapidated building at Second and D streets NW, and assured him it would be made into a "model shelter."

Since then, it has all degenerated into acrimony and recriminations, the federal government invoking local responsibility, and Snyder insisting that Reagan welshed on his word for fear that 50 states would demand model shelters if this one were made habitable with government funds. The lawsuit was Snyder's last card.

But fasting was not a courtroom option, and Snyder did the next best thing. He jumped up from his seat in the first row and, moving rapidly toward the center aisle, began to speak out over the lawyerly droning. He would not, he said, stay any longer and "hear the work of these people denigrated."

Two large marshals bore down on him as Snyder shouted, "We are caring for the people that nobody else will care about."

Suddenly, in the confusion, the voice of the judge was clearly heard.

"Marshal," he said, to the astonishment of all, "do not do that."

Snyder was by then out the door. "Bring him back," said the judge.

Snyder came back in, and Richey invited him to speak. "You can say anything you want," he said, stilling speculation that Snyder might have added contempt-of-court charges to his quarrel with the president.

The judge, it seems, welcomed the outburst. He needed someone who would help him grope his way through the legal thicket to the decent thing. Snyder, certain in his denims, and the judge, troubled in his black robes, fell into an amazing exchange.

"We need your help in these times," said the agitator.

Richey replied humbly, "Mr. Snyder, I can only do so much, and I know I will have your respect and you will have mine, regardless of how this comes out."

"You will have my love," Snyder shot back.

"Sir?" asked the judge.

"You will have my love," Snyder repeated. The judge replied, "You will have mine."

Love was not in the pleadings of either side -- nor is it an item in the Reagan budget -- but it had made its way into the courtroom. Snyder, who was embraced by his lawyer, said, "The judge is a wonderful man, and he's just like the rest of the country, doesn't want to think about the homeless, but knows we have to."