The U.S. Court of Appeals here ruled yesterday that the Reagan administration acted illegally last October when it ended the 12-year government effort to equip cars with air bags or automatically closing seat belts.

In a harshly worded opinion, the court overturned the decision by Raymond A. Peck Jr., the head of the National Highway Traffic Safety Administration, to terminate the agency's "passive restraint" regulation.

Considered the most important and controversial of the federal traffic safety regulations, the rule would have required auto companies to install passive passenger restraints in all new cars by September, 1983.

The court said Peck's decision was "arbitrary and unlawful," "unsupported by the evidence in the record," and based on a "hollow" conclusion.

Judge Abner J. Mikva, writing for the unanimous three-member panel, said the NHTSA action represented "an expensive example of ineffective regulation of the worst kind" that took greater account of the poor financial health of the auto industry than of traffic safety, which is the agency's chief mandate.

"By rescinding the passive restraint standard without any legal justification, NHTSA . . . has wasted administrative and judicial resources and has possibly delayed without justification a safety standard that may be, 'from an economic point of view, as important as any environmental, health, or safety rule now on the books,' " the court said, citing an economist who had argued against the NHTSA.

"At present rates, one in every 60 children born today is expected to die in an automobile accident and two out of every three will suffer injuries in a crash," the court said.

The court ordered the NHTSA to begin reconsidering its decision immediately. In what some lawyers called an unusual remand order, the court directed the agency to draw up within 30 days a timetable for its review.

If the review ultimately leads to more substantial justifications for the repeal of the rule, the court said it will not block the agency's decision. Otherwise, the court said it expected the agency to begin implementing the rule on a delayed schedule or begin a rule-making proceeding to modify it.

NHTSA officials had no immediate comment on the decision, saying agency lawyers had not yet read it. The Motor Vehicle Manufacturers Association, which supported the NHTSA's revocation of the passive restraint rule, also had no comment.

However, insurance companies and consumer groups that had campaigned for passive restraints praised the court's decision.

Lowell R. Beck, president of the National Association of Independent Insurers, called the decision a "lifesaver" that would save 10,000 lives and $2.4 billion annually, assuming that passive restraints are installed.

Clarence M. Ditlow, executive director of the Center for Auto Safety, acclaimed the court for compelling the NHTSA to give passenger safety a higher priority than auto company profits.

The passive restraint rule was first proposed in 1969; in 1977, after years of debate, the Carter administration issued an order requiring air bags or automatically closing seat belts in the front seats of all new passenger cars in three steps: large cars by September, 1981; compacts by September, 1982, and small cars by September, 1983. The 1981 deadline was delayed by the Reagan administration just after it took office, before the entire rule was repealed. Initially, the auto manufacturers had concentrated on developing air bags, which would be automatically inflated at the instant of impact.

By last year, the manufacturers had abandoned air bag technology as too costly and uncertain, a position challenged by their critics, and were working instead on shoulder and lap belts that would close automatically as the car doors were shut.

The rule became a prime target for President Reagan, who had attacked it repeatedly during the campaign as unnecessarily costly for consumers and the auto industry.

When the Reagan administration took office, the rule was at the top of its regulatory "hit list." Ten months later, Peck, Reagan's appointment as administrator of the NHTSA, rescinded the rule over the objection of much of his staff.

Peck argued that the rule would not offer significantly more protection than the manual belts now in cars, and he launched a publicity campaign to persuade more motorists to buckle up.

The court found that that conclusion was "arbitrary and illogical" because "there is not one iota of evidence to support NHTSA's conclusion" that the rule would not increase seat belt usage.

If the NHTSA was in doubt, the court said, then it should have, at a maximum, suspended the rule while it conducted studies about its effectiveness.