The White House is moving toward a decision within the next three weeks on whether to replace Charles F. C. Ruff as U.S. attorney for the District of Columbia, considered one of the most prestigious law-enforcement jobs in the country.

Sources said that the Reagan administration began to focus attention on Ruff's future after he personally took over the prosecution of John W. Hinckley Jr., who is accused of shotting President Reagan March 30. One knowledgeable source said that it would be politically sensitive -- and impractical -- to replace Ruff once the Hinckley prosecution is fully under way.

The Justice Department, however, had begun considering candidates for U.S. attorney here before Hinckley's arrest, and so far has interviewed half a dozen lawyers for the top prosecutor's job. It is considered unlikely that Ruff, a Carter appointee, could retain his post since the Reagan administration has generally decided to appoint new Republican-backed prosecutors.

Meanwhile, the possibility that Ruff will be replaced has kicked off an intense behind-the-scenes campaign between two former prosecutors who have emerged as leading contenders for the job.

Joseph E. diGenova, chief legal counsel to the Senate Rules Committee, has strong support from an array of powerful Republican senators, including Majority Leader Howard H. Baker Jr. of Tennessee, Judiciary Committee Chairman Strom Thurmond of South Carolina, Reagan adviser Paul Laxalt of Nevada and DiGenova's boss, Charles McC. Mathias of Maryland.

The other contender, Paul L. Friedman, a partner in the Wall Stree law firm of White & Case, has backing from Arizona Sen. Barry Goldwater and from various local judges and prominent lawyers. Deputy Attorney General Edward C. Schmults is a former partner in White & Case.

The replacement of former U.S. attorney Earl J. Silbert in 1979 was marked by unsuccessful efforts by city Democratic leaders to win selection of a black for the job.

This time, however, city leaders appear to have no prominent role in the selection process and no blacks have been mentioned as potential candidates for the top prosecutor's post in a city whose population is 70 percent black.

The competition instead seems to have come down to a choice between DiGenova, 36, a Republican with impeccable political ties, and Friedman, 37, an independent and accomplished lawyer who is a former clerk to two federal judges and a member of the hierarchy of the local legal establishment.

However, some sources said the Reagan administration might continue to search for an older lawyer with more experience -- ideally a "a 50-year-old superstar who is also a Republican," according to one lawyer.

But there seems little chance, the lawyers agree, that any such lawyer would relinquish a high-paying job in private practice for the $52,000-a-year post of U.S. attorney -- despite the prestige of heading a high-visibility prosecutorial staff of 163 lawyers.

While the lobbying intensifies for DiGenova and Friedman, Ruff said yesterday that no one has told him he's going to be replaced and "until somebody tells me that, I'm going to keep doing the job because it's fun."

Ruff, 41, a former special Watergate prosecutor whose term as U.S. attorney expires in 1983, acknowledged, however, "I doubt there is anybody standing up and actively shouting in my behalf.

"As I've said many times, this is the best lawyer's job in Washington. I would like very much to serve out my term," Ruff said.

If the White House moved immediately to appoint a successor to Ruff, it could take several months before the nomination was confirmed by the Senate.

Besides Friedman and DiGenova, others mentioned for the top prosecutor's job include David M. Barrett, who headed the Reagan transition team at the Securities and Exchange Commission, Assistant U.S. Attorney James F. Rutherford and D.C. Superior Court Judge Donald S. Smith, a former federal prosecutor.

Friedman, a member of the D.C. Bar's Board of Governors, was the first law clerk to U.S. Court of Appeals Judge Roger Robb, who at one time was Barry Goldwaters lawyer. Yesterday, in a telephone interview, Robb said that he has talked to numerous judges on Friedman's behalf. "I've talked to anybody who would listen," said Robb, adding that he thought Friedman would be a splendid federal prosecutor.

DiGenova has had a long career on Capitol Hill.As Mathias' administrative assistant and campaign aide, he made speeches for the Maryland senator during the 1980 campaign.