Russell T. Baker Jr., a top Justice Department official and career prosecutor who helped investigate former Vice President Spiro T. Agnew, was selected yesterday to be U.S. attorney for Maryland.

The choice by Sen. Paul Sarbanes (D-Md.) was prised by Baker's former associates in the federal prosecutor's office in Baltimore. They interpreted it as a clear indication that aggressive pursuit of political corruption and white-collar crime will continue in Maryland.

Baker, 35, is currently deputy assistance attorney general in the Justice Department's criminal division, which supervises the nation's most important federal investigations. His name will be sent to President Carter and Attorney General Griffin Bell, who will send the nomination to the full Senate for confirmation.

Baker apparently was not anyone's first choice for the job. President Carter and Maryland Acting Gov. Blair Lee lobbied for the selection of Dwight Pettit, a black Baltimore attorney who was active in Carter's election campaign.

Sarbanes, according to several sources, would have preferred to nominate an older, more experienced attorney. These sources said Sarbanes offered the job to at least three such lawyers, all of whom turned him down.

Afred Scanlan, a former judge from Montgomery County, said Sarbanes asked him to take the post several weeks ago. Scanlan said he rejected the offer because he did not want a political appointment and "I'm really not prosecutorial oriented."

"I think it's great," said Daniel Hurson, an assistant U.S. attorney for Maryland who with prosecutors Barnet D. Skolnik and Ronald Liebman obtained the recent corruption conviction of Maryland Gov. Marvin Mandel. "I think the guy (Baker) is very much plugged in to how this office ought to run . . . He'll contineu the tradition of vigorous prosecution of public corruption that this office has always been interested in."

Baker conceded yesterday that he "wanted to be U.S. attorney in Maryland for a long time. It's one of the world's greatest jobs. The kinds of things it has done in the past are examples of what it can do in the future . . . and I intend to continue, if not enchance that."

A Baltimore native and Democrat who has not been active politically, Baker would succeed Jervis S. Finney, a Republican who is stepping down after two years as U.S. attorney.

As an assistant U.S. attorney in Maryland from 1971 to 1974, Baker helped Liebman and Skolnik conduct the investigation of Agnew, beginning a chain of prosecutions that toppled Mandel, Baltimore County Executive Dale Anderson, Anne Arundel County Executive Joseph W. Alton Jr., and other officials.

It was Baker who picked up the first indication that there was evidence sufficient to show that Agnew accepted cash kickbacks from architects and engineers seeking contracts with the state of Maryland.

Baker left the U.S. attorney's office and the corruption team after Agnew pleaded no contest to tax charges and resigned the vice presidency.

At the end of 1974, Baker joined the prestigious 49-member Baltimore law firm to Piper and Marbury. He remained there until being appointed to the Justice Department job, where he has been in charge of the organized crime, racketeering and public integrity sections.

Baker graduated from Williams College, then spent two years in Africa with the Peace Corps before going to Harvard Law School, where he was graduated magna cum laude in 1969. He spent two years as a law clerk for U.S. Circuit Court of Appeals Judge Harrison L. Winter and Chief Justice Warren Burger before he became an assistant U.S. attorney in Baltimore in 1971.

Baker, called Timmy by his friends, said he did not seek the office and that when Sarbanes offered it to him two weeks ago "it was a very hard choice."

"I like to be out with the troops and even this job (in the Justice Department) is too far from the line. I don't want to be riding the mahogany (as a higher Justice Department official)."

In Baltimore, he said, "I'm not going over there to twiddle my thumbs." He mentioned "cleaning up the docks," the Teamsters and zoning corruption as possible of his attention. In general, he said, "I think it would be more important to the quality of life in this country that instead of convicting 10 corrupt governors, to convict 1,000 corrupt zoning officials."

When he assumes the top prosecutorial position, Baker will become the boss of the man he used to work under: Skolnik. Baker and Skolnik prosecuted former Prince George's County Commissioner Jesses S. Baggett and developer Ralph D. Rocks on corruption charges in 1972.

Baker's only active political involvement was recent. For a few months, before he joined the Justice Department nearly a year ago, he worked on the campaign committee of Maryland attorney general candidate Stephen H.Sachs, a Baltimore lawyer and former U.S. attorney.

One man believed to be influential in Baker's selection was Deputy U.S. Attorney General Benjamin R. Civiletti, his current boss, a Baltimorean who is a former campaign adviser to Sarbanes and still maintains close contact with the senator.

Petit, who noted that he has been in weekly contact with members of the Carter administration since he applied for the prosecutor's post several months ago, said he was "disappointed, but not bitter" about being passed over.

"I had the overwhelming support of the political and business establishment in Maryland," Petit said. "But I guess Sen. Sarbanes just wanted to do his won thing."

Several sources said Petit's chances may have been hurt by the fact that, in 1973, he had filed a class action suit against the Maryland Bar, charging that its entrance exam for lawyers was "discriminatory." Pettit had flunked the bar exam twice after graduating from Harvard Law School.

"I really don't think that was a factor in the selecton," Pettit argued. "It didn't stop President Carter to Gov. Lee from supporting me."