U.S. Attorney Charles F.C. Ruff, the top prosecutor here for the last two years, resigned yesterday, clearing the way for the Reagan administration to name D.C. Court of Appeals Judge Stanley S. Harris as his replacement.

Ruff said he was notified by the administration on Thursday that Reagan would send Harris' nomination next week to the Senate, which must act on the appointment.

Although Ruff was appointed to a four-year term by former President Jimmy Carter, the U.S. attorney serves at the discretion of the president and it was long expected that Ruff would be replaced by a candidate supported by the Republican administration.

Harris became the administration's choice for U.S. attorney after strong local opposition forced the White House and the Justice Department to back off the planned nomination of Brooklyn prosecutor Thomas P. Puccio to the job. Local bar leaders, lawyers and a majority of the D.C. City Council objected to the nomination of Puccio, the chief prosecutor in the Abscam bribery cases, because he was not from Washington.

Harris, a native Washingtonian, has been in private law practice in Washington and has been a judge on the local appeals court for 10 years. Harris also served on the D.C. Superior Court as a trial judge for one year before joining the appellate bench.

Ruff said yesterday that his resignation will be effective when his successor is sworn in. Ruff said he was "looking for a job" and is interested in going into private law practice.

He declined to release a copy of the resignation letter he sent to the White House and the Justice Department, saying he preferred to wait until Monday when he plans to distribute it to the more than 100 lawyers who work for him in the federal prosecutor's office.

"As I've said many times . . . this is the best job I have ever had. Maybe the best job I ever will have," Ruff said during a brief interview in his office.

Ruff was acting deputy attorney general, the second-ranking lawyer in the Justice Department, at the time he was appointed as U.S. attorney. He began his career in the Justice Department in 1967 as a trial lawyer and was chief prosecutor of former United Mine Workers President W.A. (Tony) Boyle, who was convicted of making illegal campaign contributions.

From 1975 to 1977, Ruff was on the Watergate special prosecution force and was the fourth and final Watergate special prosecutor. Ruff worked as deputy inspector general at the former Department of Health, Education and Welfare and later returned to the Justice Department before he became the federal prosecutor.

As U.S. attorney, Ruff was popular among District politicians and lawyers for the city because of his support for transfering control over criminal cases from the federal prosecutor's office to a proposed local district attorney. That plan, which was vigorously opposed by some lawyers in Ruff's office and by his predecessor, Earl J. Silbert, has effectively been shelved by the Reagan administration.

During his tenure as U.S. attorney, Ruff has instituted numerous changes in the internal workings of the prosecutor's office, changes that some assistant prosecutors have complained created new levels of bureaucracy that impeded decision making.