The national associations of pediatricians and children's hospitals filed suit against the Reagan administration yesterday to block a new federal rule that seeks to prevent doctors from simply stepping back from infants born with birth defects and letting them die.

The immediate legal issue is that the government did not allow proper time to comment on the rule, which is scheduled to take effect next Tuesday, only 15 days after it was first proposed.

A more fundamental issue, according to Dr. James Strain, president of the American Academy of Pediatrics, is that the "regulation would inject federal investigators into the pediatric wards of this country in a way that is dangerous to the health and lives of seriously ill infants."

He said yesterday that medical groups and the government share the same goal, "to protect the lives of all children, including handicapped children," but he argued that ethical review groups in individual institutions are the proper overseers of decisions to forgo life-sustaining treatment.

The new Department of Health and Human Services regulation has been vigorously supported by conservative "right-to-life" groups and personally endorsed by President Reagan.

It would require hospitals to post federal notices in delivery and nursery units that failure to feed and treat handicapped infants is against the law, and it would set up a government hotline for calling in complaints. Violations could lead to denial of federal funds to the hospital involved.

The regulation elaborates on a government warning issued last spring following the highly publicized "Baby Doe" case. A Bloomington, Ind., baby died in April after his parents, backed by their physician and the courts, allowed food and treatment to be withheld. The child was born with Down's syndrome, which leads to mental retardation, and respiratory and digestive complications requiring major surgery.

Anti-abortion groups such as the American Life Lobby pushed for federal action against what they saw as a growing problem of infanticide.

The pediatrics organization, representing 24,000 physicians who take care of children, yesterday called the government's regulatory response a "dangerous and unprecedented intrusion" into the traditionally confidential relationship between physicians and their patients which could do more harm than good.

It was joined in the lawsuit, filed in U.S. District Court here, by the National Association of Children's Hospitals and Related Institutions and, locally, by Children's Hospital National Medical Center.

In addition, the academy and 12 health groups wrote to new HHS Secretary Margaret M. Heckler to protest that the rule was issued without the normal 60-day period for public comment. The American Medical Association sent a similiar protest. The department says the emergency rule was warranted "to protect life from imminent harm."

The President's Commission for the Study of Ethical Problems in Medicine and Biomedical and Behavioral Research is scheduled to issue a report on the new rule next week. It is expected to be critical.

The commission has indicated that it favors local decision-making by hospital ethics panels. But staff members said its report also raises questions about the way the "Baby Doe" case was handled.

A news conference yesterday morning called to announce the lawsuit was followed in the afternoon by a hastily called session at HHS by Surgeon General C. Everett Koop.

Koop, a distinguished Philadelphia pediatric surgeon and former activist in the "right-to-life" movement, defended the new regulation as necessary "to save the lives of children in jeopardy....The rule does not require prolonging the act of dying, but, rather, protecting the act of living through appropriate nourishment and care." He maintained that it would not have affected the way he practiced medicine.

A similiar position was taken by the National Right to Life Committee's president, Dr. John C. Willke.