President Carter and Attorney General Griffin B. Bell yesterday denied suggestions that they were replacing denied suggestions that they were replacing a successful Republican prosecutor in Philadelphia because of pressure from a Democratic congressman under investigation there.

While they would not say so directly, David W. Marston, the U.S. attorney in Philadephia, and Pennsylvania's two Republican senators implied that Carter and Bell had decided to fire Marston because of a phone call to Carter from Rep. Joshua Eilberg (D-Pa), teo months ago.

Eilberg, Republican sources in Washington and Philadelphia have said in recent days, is the subject of a criminal investigation by Marston's office.

THe implication was that the Carter administration was guilty of playing politics with the Justice Department and its investigations, just as Carter had accused the Watergate-stained Nixon administration of doing.

In separate news conferences, Carter and Bell both said the decision to replace Marston was made months ago and that they were unaware until the last few days of even a rumor that Eilberg was under investigation.

Carter acknowledged at his nationally televised news conference yesterday that he had received a phone call from Eilberg, who "wanted the replacement, process expedited."

At his later meeting with reporters, Bell said that the President had called him about the matter, in mid-November, complaining that the was not moving fast enough to remove Marston.

But both men said they had no knowledge of any possible investigation of Eilberg, and emphasized that the decision to remove Marston had been made long before.

In Philadelphia. Marston, without naming Eilberg, said he had told a top Justice Department official about the investigation in question.

It was learned that Marston did in fact tell Deputy Assistant Attorney General Russell T. Baker Jr. - who has just been named the new U.S. attorney for Maryland - that Eilberg had been involved in some transactions in a Philadelphia hospital project that was under investigation.

It could not be learned last night how far up the Justice chain of command this preliminary information was passed.

Bell said yesterday that the controversy over whether Eilberg is under investigation was an unrelated issue because he had decided last February or March to replace Marston, despite recommendations by his top aides that he be retained.

"I think he was a political appointment," Bell said of the 35-year-old former aide to Sen. Richard S. Schweiker (R-Pa.) who took office only four months before the Ford administration ended. He added that tMarston had never tried a case, and "I want my U.S. attorneys to try some cases."

The flurry of activity yesterday capped several days of an increasing show of grassroots support for Marston in Philadelphia. A local television station had taken up his cause and urged viewers to call the Justice Department and White House to register protests, which they did by the hundreds.

Eilberg, 56, is chairman of a key House Judiciary subcommittee which Bell must deal with on a variety of legislation, including the Carter administration's complicated plan to solve the nation's illegal alien problem.

But both men said they had no knowledge of any possible investigation of Eilberg, and emphasized that the decision to remove Marston had been made long before.

The five-term Democrat is also known to be a close ally of Philadelphia Mayor Frank Rizzo, whose local organization has come under increasing scrutiny by federal investigators.

The controversy over Marston's ouster is just the latest in a series of partisan battles over the Carter administation's choice for new federal prosecutors.

Carter has named 65 new U.S. attorneys since he took office, all but one of them Democrats, a department official said yesterday. There are 94 U.S. attorneys.

Philip Van Dam. a former aide to Sen. Robert P. Griffin, (R-Mich) refused to resign last spring to make way for a Democratic successor, and was finally fired by Carter.

In September Jonathan L. Goldstein, who had earned a reputation for busting political corruption in New Jersey, was also forced to resign.

And a fight between Democratic candidates for the U.S. attorney's post in Pittsburgh broke out last fall when the western Pennsylvania House members couldn't agree on a replacement for a Republican.

The Martson controversy also calls into question again President Carter's campaign promise to take politics out of the Justice Department by choosing U.S. attorney and federal judges solely on the basis of merit.

Bell said candidly at a luncheon speech Tuesday that politics was a consideration in deciding to replace Marston. "We have two parties. The ins are the Democrats. They can get in to complain easier than the other party can . . . I have nothing against Marston. He's a fine young man. But this is the political system in this country."

Both Schweiker and Pennsylvania's other Republican senator, John H. Heinz III, condemned the decision to replace Marston.

Heinz said Carter's performance "makes clear that this administration will not live up to its promises of reform and has opted instead for a policy of politics as usual in the conduct of justice." CAPTION:

Picture 1, Police bomb experts prepare to enter Municipal Center after explosion in a weapons storage room. By Pen Wilson; Picture 2, DAVID W. MARSTON . . . center of controversy