William E. Hellerstein, a senior attorney at New York's Legal Aid Society, has an impressive list of people who think he should be a federal judge.

The Harvard Law School graduate has the blessing of both New York senators, Republican Alfonse M. D'Amato and Democrat Daniel Patrick Moynihan. Twenty-four former federal prosecutors have endorsed Hellerstein as "an outstandingly able lawyer." He was recommended by a screening panel headed by Leonard Garment, a lawyer for Attorney General Edwin Meese III.

But Hellerstein apparently will never sit on the federal bench, for critics have persuaded the Reagan administration that he is too liberal. Administration sources say the proposed nomination is dead.

For months now, some of the country's most powerful people and interest groups -- senators, governors, administration officials, conservative activists, lawyers, bar associations -- have been busily involved in a sometimes combative yet largely unpublicized process that may turn out to be the most important single governmental exercise of the year.

It is the filling of 114 federal district and appeals court judgeships, an extraordinary total that comes to a seventh of the seats on the entire federal bench.

Eighty-five of the seats were created by Congress last year as part of a bankruptcy courts bill. Another 29 vacancies have been created by attrition. Together they give President Reagan the greatest opportunity in memory to transform the federal judiciary.

By the end of his second term Reagan -- who in his first four years gave judgeships almost exclusively to white males believed to share his view of the limited role of the courts -- is likely to have named a majority of the nation's 744 federal trial and appellate judges, leaving a legacy that will far outlast his presidency.

The way federal judges are picked is a curious mixture of professionalism and patronage, a backstage contest in which outside forces can sink a qualified nominee almost without warning.

In one recent case, Republican senators and conservative activists helped torpedo the nomination of Andrew L. Frey to the D.C. Court of Appeals, because of his membership in pro-abortion and gun-control organizations. In another, some conservatives and business groups are determined to block a district judgeship for Central Intelligence Agency general counsel Stanley Sporkin, who was nominated at the behest of his boss, CIA Director William J. Casey.

It is a process in which 55 Republican senators have almost as much sway as the White House. In ideological terms, conservative senators generally are in tune with the administration. "I want to appoint someone who is at least as concerned about victims' rights as criminals' rights," said Sen. Phil Gramm (R-Tex.).

Moderate Republicans have won appointments for several less-conservative judges, but they are careful not to go too far. "We're not going to be submitting an ultraliberal who would obviously be anathema to the White House," D'Amato said.

Sheldon Goldman, a judicial expert at the University of Massachusetts at Amherst, said Reagan's approach differs sharply from that of previous Republican presidents.

"This administration," Goldman said, "is making a greater concerted effort to ideologically screen the people considered for the judiciary than at any time since Democrat Franklin D. Roosevelt's first term," 1933 to 1937. "It is not as important to them to achieve the blessings of the professional organizations on whether they are placing the very best minds on the bench."

Administration officials say they are seeking the brightest and most experienced attorneys who share the president's philosophy of judicial restraint.

"We're looking for people who view the role of the courts as interpreting the law, not enacting it," White House counsel Fred F. Fielding said. "There is an imbalance in some areas of the federal courts, a tendency toward judicial activism. We want to have a balance."

"The president views this not as patronage, not as a nice reward for fund-raising prowess, but as some of the most important decisions he will make," said James M. Spears, acting director of the Justice Department's Office of Legal Policy.

When it comes to naming district court judges, Reagan often follows the long tradition of accepting candidates recommended by the home state senators of his party. But administration sources report a surprising number of unpublicized cases in which the White House has rejected a Republican senator's choice as too liberal or unqualified.

Many senators try to avoid such problems by relying on screening committees to recommend candidates. But political considerations remain vital.

"I don't think you can eliminate politics from the selection of judges," said Washington attorney Jonathan C. Rose, former head of the Office of Legal Policy. "The question is whether it plays an improperly large role as opposed to the qualifications and merits of the candidates . . . . Senators sometimes feel obligated to reward political associates as opposed to the most distinguished lawyer in their state."

The White House has a freer hand in filling vacancies on the appeals courts, which cover several states, although senators still push their favorite candidates.

The judge-choosing process generally works like this:

Names of candidates are submitted to the Office of Legal Policy, which reviews their work, surveys their colleagues and interviews leading contenders. After Attorney General Meese settles on a candidate, he sends the name to a White House selection committee chaired by Fielding. This committee, which also includes Meese, White House chief of staff Donald T. Regan and political director Edward J. Rollins, either endorses the finalist or raises objections.

The candidate then undergoes an FBI background check and is evaluated by the American Bar Association. If no problems surface, the panel sends his name to the president.

In practice, the internal jockeying can be fierce. Former White House official Morton C. Blackwell said that conservatives frequently mount campaigns against judicial nominees, and that "the major point of contact for these conservative groups was Ed Meese when he was in the White House." Meese's influence will be equally great as attorney general, Blackwell said.

These backstage disputes over nominees sometimes spill out into public view.

For example, Hellerstein's nomination ran into trouble last year after New York conservatives questioned whether the Legal Aid lawyer was too sympathetic to defendants. They sent the administration some of Hellerstein's writings, including a 1970 article discussing alternative sentencing for such victimless crimes as prostitution and drug possession.

Hellerstein was recommended under an unusual New York arrangement that allows the senator whose party is out of power (in this case Moynihan) to pick one out of four district judges. D'Amato said he endorsed the choice because Hellerstein "has fine legal credentials. But in the final analysis, it's the president's prerogative."

Hellerstein said his approach as a judge would not necessarily mirror his 20 years of filing appeals for Legal Aid clients. "I happen to represent poor people instead of rich people," he said.

Garment called Hellerstein "a prudent and experienced criminal law professional." But in every administration, he said, nominations "tend to be driven by the lowest common denominator. If someone is against a candidate and points out a blemish or flaw or defect, it frequently can carry the day."

Reagan's 1984 nomination of Frey, the deputy solicitor general, came under heavy conservative fire, and administration sources say this was one reason another candidate was recommended last week.

Officials from antiabortion and gun-ownership groups bitterly criticized the D.C. court nomination last summer after it was disclosed that Frey is a member of the National Abortion Rights Action League, Planned Parenthood and the National Coalition to Ban Handguns. Thirteen Republican senators, led by Jeremiah Denton (R-Ala.), told Reagan in a letter this month that they would fight the nomination because Frey is "a consistent supporter . . . of legalized abortion" and "a staunch advocate of gun control."

Frey, a leading authority on criminal law who was recommended by a D.C. nominating panel, had acknowledged that he differs with the administration on some social issues.

The Frey dispute may presage a more active role for conservative groups. Howard Phillips, director of the Conservative Caucus, said that Reagan "should not appoint anyone to the bench who is pro-abortion" and that his group has targeted other candidates with such views.

Meese said last week that he will seek appointment of judges who believe in "the sanctity of human life." But both Meese and Fielding say the administration has no "litmus test" and does not reject judges according to their stance on abortion or any other single issue.

Some friends of high administration officials have fared well in securing nominations. They include the CIA's Sporkin and Kenneth W. Starr, who was named to the appeals court here after serving as counselor to former attorney general William French Smith.

A clear picture of Reagan's judicial appointments emerges from his first four years. According to a study by Goldman, one-quarter of Reagan's judicial appointees are millionaires. Their average age was 50. Two-thirds of the appeals court nominees had previous judicial experience, reflecting the White House desire to tap people with proven track records.

The figures also show that the 165 judges Reagan named in his first term included only two blacks and 13 women. This is a sharp reduction from the 40 women and 37 blacks named to the federal bench by President Jimmy Carter.

Reagan aides say that they have had difficulty finding qualified blacks who share the administration's philosophy and that few senators have sent them black nominees. But they also say they will not bend their ideological goals just to boost their percentage of minority appointments.

"We're mindful of the appearance problem," Fielding said. "We would like to identify more candidates for consideration that are women, blacks and minorities, but we are not going to do it using quotas as a device to accomplish that."

Much of the initial screening is done on Capitol Hill, where senators have varying approaches to naming judges.

Some, like Gramm, keep their screening panels secret to insulate them from lobbying. The Texan has surprised some observers with his choices, which include a Democratic House member, Rep. Sam B. Hall Jr., and a 31-year-old state judge.

Others, like Arlen Specter (R-Pa.) and John Heinz (R-Pa.), refer all callers to their screening panel. "One of the good things about these judicial screening panels is that you deflect all that pressure," a Senate aide said.

Lowell P. Weicker Jr. (R-Conn.) picks the nominees himself. Charles McC. Mathias Jr. (R-Md.) sends the Justice Department three to five names from his screening panel, with no recommendation. Mark O. Hatfield (R-Ore.) and Bob Packwood (R-Ore.) pass on a list of five contenders picked by the state bar association.

Pete Wilson (R-Calif.) has two screening panels, one for merit selection and one made up of Wilson's political associates. A Wilson aide said the second panel conducts "a political screening process . . . . Are these people good Republicans or good conservatives? Are they registered? Have they done any work for the Republican Party? We know the White House is going to look at that."

In states with no GOP senators, the administration takes district court suggestions from Republican House members, governors and campaign officials. "You get a lot of letters, a lot of telephone calls, a lot of people who just happen to be stopping by," Spears said.

"It's a very funny process," Fielding said. "You're sitting here and you don't know a thing about the Nebraska bar. We are really dependent on people bringing us names."

However the choices are made, there is no question that Reagan is living up to his campaign pledge to name judges who take a conservative view of crime and punishment. And that, Goldman said, is the way the process is supposed to work.

"This administration is furthering its goals," he said. "It may not be your goals or my goals, but that's why we have elections. When we elect a president, we're electing a judiciary."