President Reagan, commenting on the case in which a New Yorker allegedly shot four teen-agers who accosted him on the subway, yesterday cautioned against people "taking the law in their own hands."

Asked about the widely publicized case during his news conference last night, Reagan said: " . . . I think we all realize that there is a breakdown of civilization if people start taking the law in their own hands.

"So while we may feel understanding or sympathy for someone who was tested beyond his control . . . , at the same time we have to . . . abide by the law and stand for law and order."

Reagan's comments came after hospital officials in New York disclosed that one of the black youths shot Dec. 22 had suffered respiratory arrest and lapsed into a coma.

Darryl Cabey, 19, was breathing with the aid of a respirator after his condition worsened to critical, according to St. Vincent's Hospital spokesman Dan Sorrenti. Cabey, the most seriously wounded of the four, was paralyzed below the waist and contracted pneumonia last week.

The subway shooting, in which police have charged Bernhard Hugo Goetz, 37, has become a national cause celebre and has prompted an outpouring of public support for the gunman as a symbol of a crime victim who fought back. The gunman shot the four youths after they approached him on a subway train and asked for $5.

But Reagan yesterday joined New York Gov. Mario M. Cuomo (D) and Mayor Edward I. Koch, who have urged the public not to glorify vigilante-style justice.

While saying he could not comment on a case before the courts, Reagan said that "we all can understand the frustration of people who are constantly threatened by crime and feel that law and order is not particularly protecting them."

He said there are some areas where criminals "have found happy hunting," and he criticized "an attitude . . . in which it seemed that we got overzealous in protecting the criminal's rights and forgot about the victim."

But he said "a lot . . . depends on all of us in our insisting on law and order." He said authorities have been making "sizable progress" against crime and that serious crimes have declined for two consecutive years.

Goetz, who has been charged with four counts of attempted murder, made a brief court appearance yesterday as New York prosecutors won additional time to prepare their case against him. Assistant Manhattan District Attorney Susan Braver told a state judge that prosecutors are gathering evidence.

Goetz, wearing denim jeans and a leather jacket, said nothing during the minute-long session. He left Rikers Island jail Tuesday after posting $50,000 bail. The self-employed electronics specialist surrendered to police in New Hampshire last week.

Three of the teen-agers have been unable to testify before a grand jury because of a dispute with authorities over whether they will be granted immunity from prosecution; Cabey is unable to testify. Goetz's lawyer said his client will not appear before the grand jury.

Meanwhile, donations continued to pour in to Goetz's legal defense fund, and authorities said they have received more than 350 letters about the case. Many praise Goetz as a hero.

"Bernhard, it is so good to hear that people like you have the courage to confront these 'animals' who are out scaring and degrading people," one writer said.

"I hope that his struggle against the crooks who run the city is as successful as his struggle against the barbarians who roam the subways," another wrote.

Cabey's mother, Shirley, told the wire services that "I hope that people realize when they say it was good for my son to be shot that he will never walk again. Every time I hear how much of a hero the gunman was, it hurts."