A federal judge here warned Reagan administration officials yesterday that they would be in contempt of court if they defy his order and try to restore tax exemptions to racially discriminatory private schools in Mississippi.

Administration officials were tongue-lashed as well at a hearing by members of the House Ways and Means Committee who attacked their legal reasoning and, at times, their motives in the controversial Jan. 8 decision to reverse prior policy and grant exemptions for discriminatory schools. Rep. William M. Brodhead (D-Mich.) said their testimony was "the most incredibly unbelievable crap" he'd ever witnessed before Congress.

The president now is pushing legislation that would explicitly ban exemptions for such schools but congressional leaders have expressed no interest in the bill and suggested some type of resolution instead. Several committee members yesterday pleaded with administration witnesses to let the issue be decided by the Supreme Court.

U.S. District Court Judge George L. Hart Jr. raised the question of contempt during a hearing in which civil rights lawyers were requesting that he not limit his injunction against tax exemptions to Mississippi, but extend it to apply to the whole country. They argued that tax policy must be uniform nationally, but Hart denied their petition, saying he had no jurisdiction to make the injunction nationwide.

Hart added, however, that he would hold the administration in contempt if its plans for restoring exemptions applied to Mississippi schools. He said he doubted government officials would try that "unless they like jail." And William Bradford Reynolds, head of the Justice Department's civil rights division, said the administration has no intention of violating Hart's order.

During the hearing, Reynolds and other top Justice and Treasury officials were grilled for more than two hours about the apparent inconsistencies in the legal reasoning they used to overturn the Internal Revenue Service's 12-year-old policy of banning tax exemptions for schools that discriminate.

Deputy Treasury Secretary R. T. McNamar said he couldn't understand the reluctance of Congress to act on the proposed legislation that would reinstate the ban. He said that without congressional action, the IRS would be forced by the end of the year to start granting exemptions to private schools no matter how blatantly they discriminate against blacks.

Reynolds said, in answer to a question by Rep. Fortney H. (Pete) Stark (D-Calif.), that if a group qualified for an exemption as an educational organization it couldn't be taken away even if the group "advocated murder and kidnaping on the side."

Rep. Andy Jacobs Jr. (D-Ind.) ridiculed the administration's position that it had to reverse the IRS private school policy because it wasn't specifically authorized by law. He noted that the IRS, not the law, said Social Security benefits were tax exempt, and asked McNamar when he could start telling his constituents they had to start paying taxes on their benefits.

The Treasury official replied that the Social Security issue hadn't reached his desk.

A panel of law professors told the committee earlier that there was no need for legislation because the court precedents made it clear that the old IRS policy was proper. Laurence H. Tribe, of Harvard, said government would "grind to a halt" if Congress had to pass a law every time an administrative agency filled in legislative gaps with regulations.

Randolph Thrower, IRS chief under President Nixon, testified that the original 1970 decision was based on analysis of the Constitution and law, and was approved by Nixon. Deputy Attorney General Edward C. Schmults told the Senate Monday that Nixon had bowed to political pressure, but that line was deleted from his testimony yesterday.

The questioning got so rancorous at times yesterday that Schmults had to ask Rep. Dan Rostenkowski (D-Ill.), the committee chairman, for permission to finish his answers. Rostenkowski said the administration policy reversal was based on legal analysis of "dubious scholarship" and urged a change of position.

Rep. Charles B. Rangel (D-N.Y.) accused the administration of violating the same "separation of powers" it claims it is defending, by ignoring the court precedents on the issue.