The Reagan administration has suffered a series of sometimes embarrassing setbacks in courts across the country recently, culminating Tuesday in the 8-to-1 Supreme Court ruling against it in the Bob Jones University racial discrimination case.

Court opinions show that many of the legal defeats resulted from basic legal errors, excessive haste and disregard of government procedure, as the administration rushed into ideological policy initiatives and at- tacks on long-established national policy.

Among the cases:

* In March, federal judges in Washington and New York invalidated the administration's "squeal rule" requiring family planning clinics to notify parents that their minor children were seeking birth control devices. Both judges said the government had badly misread federal law and one called the government's defense of the rule "fatuous," an "exercise in mere sophistry."

* Last month, U.S. District Court Judge Gerhard A. Gesell struck down the administration's "Baby Doe" rule, designed to protect babies born with serious birth defects from being denied food or medical treatment. Gesell judged the rule "hasty and ill-considered" and an "abitrary and capricious" violation of the law governing federal rulemaking.

* A federal appellate court also ruled last month that the administration's new detention policy for Haitians violated the Fifth Amendment and said the government failed to follow required rulemaking procedures.

* Last week, an appeals court panel in Boston threw out Reagan administration trade regulations designed to stop Americans from traveling to Cuba. The judge writing the opinion said the regulations were based on a provision of law no longer on the books.

In two cases currently before the Supreme Court, lower courts stopped the administration from lifting a passive-restraint requirement for new cars and from leasing underwater oil exploration sites off the California coast.

The pattern is causing discomfort among some of the more experienced government lawyers. "You've got ideologues sprinkled around the government," said one of these attorneys, who asked not to be identified. "They want to make a statement. But some of these things are just not defensible."

Administration officials respond that, even counting the recent defeats, they are still winning most of their policy-related cases.

"People have been kidding me the last couple of weeks about Baby Doe and parental notification," said J. Paul McGrath, chief of the Justice Department's Civil Division. "My answer is that you get a distorted view if you don't look at the broad range of things."

Pointing to administration victories over court challenges to its budget program and deregulation proposals, McGrath said, "There's always a news article when we get attacked, but rarely one when we win."

In the view of Benjamin R. Civiletti, attorney general in the Carter administration, the Reagan administration "has tried to either reverse or correct the direction of the law" in many areas. "Whenever you do that," he said, "whether trying to extend the direction with a quantum leap or counter a direction, you can expect court decisions to be chancy or unfavorable. The courts tend to be bound by the precedents and directions that have been established" in the past.

Stephan E. Lawton, who helped defeat the Baby Doe rule as attorney for the American Academy of Pediatrics, said part of the government's problem is that "they're very doctrinaire. It's very clear there's White House involvement in these cases," he said. "The question of thoughtful legal consideration is probably secondary" to the administration's policy and political objectives.

Lawton said that when he obtained the Department of Health and Human Services file on the Baby Doe rule change, which he expected would contain the usual voluminous documents associated with rulemaking, he found only a few law review articles.

"We were astounded," he said. "There was nothing that indicated the rule had even been written there. There wasn't even a draft regulation, not even a legal opinion or a decision memorandum."

Claire del Real, assistant HHS secretary for public affairs, acknowledged that the department rushed the Baby Doe rule. "We felt it was a life or death situation" for newborns, she said. The department is now trying to write a new rule, which also is likely to be challenged in court.

The Reagan administration's defeat in the Bob Jones University case was particularly embarrassing because the Supreme Court based its decision on arguments once made by the administration's own lawyers.

In ruling that the Internal Revenue Service can deny tax exemptions to private schools that practice racial discrimination, the court cited fundamental national policy against racial discrimination in education.

This came straight from a brief submitted by the Justice Department in September, 1981--before the administration suddenly switched sides on the issue on orders from the White House.