Former D.C. deputy mayor Ivanhoe Donaldson was sentenced to seven years in prison, ordered to repay the city government $112,500 and fined $15,000 yesterday, climaxing an investigation that a federal prosecutor said exposed "raw corruption" within the D.C. government.

U.S. District Judge Gerhard A. Gesell, in sentencing Donaldson on charges that he systematically defrauded the city government of more than $190,000 and obstructed the investigation of his wrongdoing, said Donaldson had engaged in a "serious breach of public trust" that belied his long and admirable career as a civil rights worker and political activist.

Donaldson, the chief architect of Mayor Marion Barry's political career, managed both of Barry's successful campaigns for mayor and later served as a top aide in both of his administrations.

Donaldson's attorney, Robert P. Watkins, appealed to Gesell to sentence Donaldson to perform extended community service work rather than serve a prison term. But the judge interrupted him, saying Donaldson's crimes were not simply "economic."

"The heart of this offense," Gesell said, was Donaldson's "getting his co-workers, friends and people who had contracts with the city to lie, cheat and obstruct justice . . . . "

Donaldson must serve a minimum of 28 months in prison before he becomes eligible for parole. Gesell further ordered that he repay the city the $112,500 before his release.

He could have received a maximum penalty of 23 years in prison and a $360,000 fine.

Yesterday's sentence follows Donaldson's guilty plea last month to three felonies -- interstate transportation of fraudulently obtained funds, obstruction of justice and tax fraud -- after a nearly yearlong investigation by the FBI and the Internal Revenue Service.

Donaldson appeared subdued standing before the bench between his two attorneys as the white-haired Gesell ordered him to report to the U.S. penitentiary at Petersburg, Va., by noon tomorrow.

"What happened was wrong," Donaldson told the judge before an overflow courtroom crowd that included his wife Winifred, former civil rights associates, city officials, reporters, and the FBI and IRS agents who investigated him. "I want to apologize to the court, to my community, to my friends, to my wife . . . . "

Donaldson pleaded guilty to receiving more than $190,000 in government funds from 1981 through 1984. The funds came from checks written on an Employment Services Department special administrative fund while Donaldson was acting director of the department and later when he became a deputy mayor, and from bogus city contracts.

Accompanied by his lawyers, Watkins and Richard Hoffman, Donaldson left the courthouse hand in hand with his wife and did not speak to reporters. Well-wishers clustered around him, shaking his hand and hugging him. Several said the prison term was inappropriate.

"I don't think the system is fair," said Dorie Ledner, who said she first met Donaldson in Mississippi in 1962 in the early days of the civil rights movement.

More than 40 persons wrote letters to Gesell attesting to Donaldson's character. Gesell said he received three such letters yesterday, including one from Coretta Scott King.

U.S. Attorney Joseph E. diGenova, speaking at a press conference immediately after the sentencing, said he was "very pleased with the sentence."

Flanked by Assistant U.S. Attorneys Daniel J. Bernstein and David A. Geneson, who directed the investigation, diGenova called for city officials to tighten the city's system for awarding millions of dollars in public contracts annually.

Citing what he called the "raw corruption" exposed by the Donaldson case, diGenova said the city government needs to eradicate "the kind of corrosive attitude" pervading all levels of city government demonstrated by the failure of subordinates to challenge Donaldson's misdeeds. "This is not an isolated case," diGenova said, calling the Donaldson case a microcosm of "very, very serious problems involving the award of contracts."

DiGenova said the investigation into allegations of wrongdoing that grew out of the Donaldson case is continuing, along with other separate D.C. corruption probes. Donaldson is likely to be called to testify before a federal grand jury investigating city government corruption, sources said.

Barry said in a statement released yesterday that he was "saddened" by his longtime aide's admitted wrongdoing, saying, "There was nothing in his past that suggests that he would do something of this nature.

"There are some who would still raise the question of whether I knew what Donaldson was doing," the mayor said. "These were transactions that would not ordinarily come to my attention, and I want to say emphatically that I did not know of them."

Barry defended his administration's system of controls for awarding contracts and monitoring the expenditure of public funds. Some City Council members, meanwhile, said yesterday that Barry needs to take action against other city officials implicated by prosecutors in Donaldson's scheme.

Council member John Ray (D-At Large) said yesterday that "the mayor has to move to take some action against some individuals involved. Different action is appropriate for different individuals."

Barry, who has declined to say what actions he plans to take concerning several city officials implicated in the Donaldson investigation, disclosed yesterday that he will issue today a "full statement on what administrative actions, if any, I will take."

Speculation within the District Building yesterday centered on whether Barry would move to oust Matthew F. Shannon, the director of the Department of Employment Services, and James George, deputy department director for finance.

The two were prominently mentioned in public court documents filed by prosecutors as having aided Donaldson in giving sham contracts and issuing checks to friends and contractors who funneled the city funds back to Donaldson. No one other than Donaldson has been charged in the case.

One District government source said Barry is giving serious consideration to removing both Shannon, a Donaldson protege who succeeded Donaldson as employment services director in mid-1982, and George, who prosecutors said sometimes had the clout to overrule Shannon because of his close personal ties to Donaldson. Both Shannon and George have declined to discuss the investigation.

Sen. Frank R. Lautenberg (N.J.), ranking Democrat on the Senate Appropriations subcommittee on the District, said the Donaldson case shows that "the District government needs tighter managerial control over its contracting programs."

An aide to the Senate permanent subcommittee on investigations said the panel is considering launching a full-scale inquiry into the city government.

City Council members and local political leaders offered mixed reaction to Donaldson's sentence, with some saying that his sentence would be a deterrent and others complaining that he should have been given a stiffer term.

"They threw the book at him," said D.C. Democratic Party Chairman James M. Christian Sr. "It sends a good, clear solid message."

However, Mattie Taylor, a Democratic candidate for mayor, said she was "extremely disappointed" that the sentence was not longer. "I'm afraid the impact will be to tell the little man in the District government that it pays to steal," said Taylor, a former employment services deputy director, who added that she believed Shannon should be fired.

City Council member Carol Schwartz (R-At Large) said she agrees with diGenova's assessment that the District needs tighter financial controls. "There is a serious problem with loose procedures which can lead to corruption," she said.

Council member Frank Smith (D-Ward 1) said the Donaldson sentence will deter others. "While I feel this was an isolated incident," Smith said, "there were some people a little loose on writing checks."

Donaldson was sentenced to three concurrent terms -- five years for fraud, seven years and a fine of $10,000 for obstruction of justice and three years and a $5,000 fine for tax fraud.

Attorney Watkins said that Donaldson, who no longer has a full-time job, wants to repay the city but he "cannot now make restitution." He said Donaldson's main asset is the equity in his condominium.