A federal judge here yesterday granted a narrow but potentially significant victory to opponents of President Reagan's tough federal hiring freeze that abruptly ruled out employment for thousands of people who thought they had new government jobs.

U.S. District Court Judge John H. Pratt, acting in a case brought by the National Treasury Employees Union, temporarily reinstated three persons who had been hired by the U.S. Customs Service before the freeze and showed up for work, only to be sent home.

Although the decision only reinstates the three for 10 days, to give another judge time to consider the case, it opens the door for a much broader legal attack on the freeze, Reagan's first official act as president. An official at the Office of Personnel Management (OPM) said that as many as 30,000 people eventually could be hired if Pratt's decision is expanded in subsequent court hearings.

Pratt said the union challengers of the freeze demonstrated a "strong likelihood that they would ultimately prevail" in their efforts to overturn the freeze, at least for those employes who actually showed up on the job only to discover they were out of work.

In particular, Pratt cited the irreprable harm done to those new federal employes who had quit other jobs, sold homes and relocated only to be informed that they were suddenly unemployed because of the freeze.

Not only is there a loss of money when this occurs, Pratt said, but there is also the "pain, suffering and anguish that accompanies this kind of trauma." i

There is a "strong public interest," Pratt said, in public officials "maintaining the integrity of their commitments, which have been violated in this instance."

The case will move next week to Judge Charles R. Richey, who must decide whether persons who received appointment letters on or after Nov. 5 are entitled to jobs. Reagan's order prohibits government agencies from hiring additional workers until further notice, and also bars employment to persons who were hired after Nov. 4 (election day) but had not begun work by Jan. 20 (inauguration day).

Despite the limited range of Pratt's decision, union officials called it significant in their battle to have the retroactive provision of the freeze rescinded.

"We're excited about it," said union spokeswoman Laura Negin. "It's very encouraging. It's the first step for us in proving that the retroactive freeze is illegal."

The White House said it had not seen a copy of Pratt's order late yesterday. A spokesman for the Office of Management and Budget said there would be no statement until the order has been reviewed.

But an official of OPM said that while Pratt did not rule on the merits of the complaint, "he left open the possibility that the finding could be broadened."

The OPM official said the freeze would be worthwhile even if the entire group of 30,000 persons with job commitments eventually is exempted from the freeze, because Reagan still could accomplish his goal of controlling the growth of government by barring all civilian hiring as of Jan. 20.

"Once we are over the hump of outstanding offers [to the 30,000], the freeze will be in place," the OPM official said.

The number of workers who would be affected if an eventual order is restricted to those who actually showed up in the first week after the freeze "could not be more than 1,000. It would probably be in the hundreds," the official said. Some supervisors did not enforce the freeze in the first few days after Reagan's order.

Pratt said that by actually reporting to their jobs, those few employes had a constitutionally protected property interest in their employment. Therefore, he said, they were owed various rights, such as a notice of termination and a right to respond, before they could be put out of work.

Of the three persons directly affected by Pratt's order, only one actually did any work on Jan. 26, the date all three reported. Bernard Allan Willer worked about four hours at Customs in his hometown of St. Paul, Minn., before being sent home. James Lee Stone and Stephan Mercado both reported for duty at Yuma, Ariz., but were turned away by a supervisor who cited Reagan's freeze order.

According to the union's petition, Stone received a commitment on Jan. 14, at his home in Corvallis, Ore., after which he and his wife and their three children moved to Yuma.