There is a forgotten man in the saga of the Carter administration's handling of the dismissal of U.S. Attorney David W. Marston of Philadelphia.

He is Joseph R. Glancey, the candidate who seemed to have all the right political backing for the job a year ago. He, like Marston, lost.

The chief judge of the Philadelphia Municipal Court, all sides, agree, was the innocent victim of a sharp political dispute. But his fate illustrates the difficulty of trying to please political allies while maintaining some semblance of Carter's "merit selection" campaign promise for judges and U.S. attorneys.

Glancey had the support of Rep. Joshua Eilberg (D-Pa.), Mayor Frank Rizzo and Jack Sullivan, President Carter's chief backer in Philadelphia. If Attorney General Griffin B. Bell had selected Glancey when hte name was suggested last March, Marston would have been replaced long before his office began the investigation of a Philadelphia hospital project that led eventually to criminal allegations about Eilberg.

But Bell's patronage expert, associate attorney general Michael J. Egan, rejected Eilberg's choice. He did so, he said, in keeping with the Justice Department's version of merit selection: that Democratic candidates must be as good as or better than the Republican they replace.

Thus, Marston was still around in November, when a frustrated Eilberg called President Carter and asked him to "expedite" the search for a Democratic U.S. attorney for eastern Pennsylvania. That call added credence to later charges that Eilberg was after Marston's job because he himself was a potential target of one of the prosecutor's investigations.

The chronology of the Justice Departent's efforts to find an acceptable replacement for Marston is evidence of the problems the administration faced last year in picking new prosecutors and judges, especially in states where there are no Democratic senators.

Though candidate Carter promised to make such selections strictly on the basis of merit, he soon shelved that plan in the face of opposition by teh Senate, which traditionally has been allowed to co-opt the president's constitutional authority.

In states such as Pennsylvania, House members from the party in power play the role of senator. Thus Eilberg, as a senior Democrat from the Philadelphia area, had a key role in naming Marston's successor.

In an interview in his office the other day, Egan traced the Pennsylvania House delegation's increasing pressure for Glancey, starting at a routine meeting in Eilberg's office March 2.

At the time, Egan said, he didn't know who David Marston was, but he soon began checking on both the incumbent and the recommended replacement, Glancey.

Egan said he found nothing in his background search to raise questions about Glacey's integrity. "He's a fine man," Egan said. "However, his support was political . . . You don't have buttons to push to come out with a judgment.You have to go on gut reaction some."

The department began looking around for other candidates. But on March 24, barely three weeks after getting Glancey's name, Egan included Marston in a list of incumbent U.S. attorneys he told Bell should be retained for the rest of their terms.

Bell rejected the advice and more possible successors to Marston were interviewed.

On May 5, Bell, Egan and White House lobbyist Frank Moore met with the state's House Democrats at the office of Rep. Daniel J. Flood, whose name also has surfaced since as a possible target of criminal investigations.

"They were not upset. THey were anxious that we move to replace three Republican prosecutors with Democrats," Egan recalled. They were still pushing Glancey.

In late June, Bell offered the job to a friend, Jerome Shestack, a Philadelphia lawyer. Shestack turned the job down.

He also suggested that Marston be kept on for a while because of the atmosphere of political corruption in the state, where two previous special state prosecutors had been sacked.

"Marston was doing an acceptable job and we knew public corruption was a big issue in the state, so we decided we weren't in any big rush to replace him," Egan said.

The Pennsylvania representatives were, however. "They finally leaned on us so hard about Glancey tht I wrote and took him out of the running," Egan said.

On Sept. 20, Egan wrote Rep. Raymond F. lederer (D-Pa.) that Glacey did not, in the department's opinion, meet the standard of being "as good or better than the person holding the job."

Still to come was the Eilberg phone call to Carter and the subsequent discovery and furor that Marston was investigating Democrats, including Eilberg.

Egan and Glancey are equally stoic about the ironic twist caused by the delays in the replacement process.

"We were troubled all along that our position tht there were other better candidates might adversely affect Judge Glancey's reputation. It shouldn't have," Egan said.

Glancey said in a phone interview from Philadelphia yesterday that he guessed he lost out because his backers probably pushed too hard and the Justice Department might not have wanted to offend the state's Republican senators by replacing Marston too rapidly.

"I can't figure it out," he said. "Sometimes you think you have all the pieces going for you . . ."