The administration, having long since infuriated friend and foe by its handling of the issue of tax exemptions for segregated private schools, found no sanctuary yesterday at a conservative Supreme Court.

The court's sharply worded 8-to-1 repudiation of the administration position brings to a close, at least for now, what by near universal agreement has been an unalloyed political fiasco for the White House.

"They got the worst of both worlds," said Paul Weyrich, head of the Committee for the Survival of a Free Congress and one of the New Right leaders who lobbied the administration to preserve the tax exemptions for religious schools that discriminate on racial grounds. "They came down right on the issue at first, but then they flip-flopped when it created so much controversy, and all they wound up doing was making both sides mad."

Yesterday's ruling drew whoops of vindication from civil rights groups, lusty denuciations from the religious right and little more than a tight-lipped acknowledgment from the administration.

"We will obey the law," President Reagan said in his lone comment on the decision. Attorney General William that read in part: "With the decision today . . . the IRS may proceed to deny . . . exemptions to those schools engaged in discrimination on account of race."

That had been the policy of the Internal Revenue Service since 1970. But on Jan. 8, 1982, the administration summarily reversed it, bowing to the entreaties of conservative political figures such as Rep. Trent Lott (R-Miss.) and Sen. Strom Thurmond (R-S.C.) as well as a broad swath of evangelical and conservative religious leaders for whom the long-simmering exemption issue had become a political rallying point. The White House was caught off guard by the intensity of the protests that followed -- protests that reached into the Justice Department.

Reagan quickly launched a retreat, which just as quickly bogged down. First his top aides took turns denying White House parentage of the policy charge, but within two weeks Reagan conceded at a news conference that he was "the orginator of the whole idea" and that "it wasn't handled as well as it could be." Then he fashioned the following position: the IRS policy to deny tax-exempt status to segregated private schools was morally right, but it was legally wrong because the IRS lacked the statutory authority to enforce such a policy.

So he ruled that Bob Jones and the more than 100 other segregated private schools in question could for the time being hang on to their tax-exempt status but he also sent Congress a bill empowering the IRS to revoke it. The bill died a quiet death. It had no constituency: groups on the religious right opposed it and civil rights groups found it unnecessary.

The decision of the court yesterday vindicated the position of the civil rights community.

"The need for legislation is moot," said Richard Larson of the American Civil Liberties Union, which filed a friend-of-the-court brief.

The NAACP hailed the court for demonstrating that it "will not be seduced into any effort to turn back the clock to 'separate but equal.'"

William T. Coleman Jr., a former transportation secretary who was appointed by the court to argue the case against Bob Jones after the administration ordered its lawyers to change sides, praised the court for saying "for the first time that racial discrimination in any form whatsoever in education institutions is against national policy."

Meanwhile, at Bob Jones University in South Carolina, where the school's more than 6,000 students are banned from interracial dating under pain of expulsion, the flags flew yesterday at half-mast. "We're mourning the death of religious freedom," said the university's president, Bob Jones III.

"I fear for this country and for my children," Jones said. "Freedom of religion is now gone. . . . America will have to conclude that there is not much difference between us and Russia. . . ."

The court ruling comes as the administration is under attack from black groups, most recently for its decision to appoint three new conservative members to the U.S. Civil Rights Commission. White House political operatives are trying to find ways to hold down the anti-Republican vote in the black community in 1984 -- but conservative leaders see little hope.

"I don't think this will do any more damage to Reagan with blacks," said Weyrich. "Even appointing Harold Washington to the Cabinet wouldn't change that situation." He said the greater potential for political damage comes from the right, where fundamentalists who registered heavily for the first time in 1980 and voted for Reagan might be disappointed and sit out 1984.