D.C. Superior Court Chief Judge Harold H. Greene ruled yesterday that City CounciL Chairman Sterling Tucker violated city restrictions on outside employment by teaching at Howard University. But the judge refused to remove Tucker from office because of the violation as city Corporation Counsel John R. Risher Jr. had asked.

In a 58-page opinion that artfully acknowledged some of the contentions that both sides had made, the judge agreed with Risher that any form of outside employment on the part of the Council chairman is prohibited by the Home Rule Charter.

At the same time, the judge concurred with the view of Tucker's lawyers that in this particular case, removal from office would be too harsh a punishment and would not be in the best "public interest."

The petition to remove the Council chairman was filed June 6 and was viewed by many - including Tucker - as a politically motivated effort by one of the mayor's closest confidants (Risher) to embarrass and damage a potential political foe.

Tucker, who has been preparing to run for mayor next year, has been one of the most frequent critics of the mayor's administration and is seen by many city political observers as the major threat to the mayor if Washington should decide to deek re-election in 1978.

The mayor has denied any advance knowledge of Risher's intentions. Risher, in a rare public statement before the court papers were filed, said he was not in office as the city's chief lawyer "to do the mayor's bidding."

Tucker never denied working at Howard, and in fact regularly reported his employment there and the income from the job to the D.C. Board of Elections and Ethics, as required by city law. But the elections board never examined the routine reports, and it was only after possible violations were alleged in the news media that Risher, with a flurry of well-publicized activity, began his probe. Citing little-known sections of city law, Risher subsequently asked that Tucker be ousted for violating the public trust.

Risher, saying he has not yet had time to read Judge Greene's opinion, said through a spokesman yesterday that he would not comment until today. Mayor Washington was out of town and city administrator Julian R. Dugas, the city's chief executive in the mayor's absence, also declined comment.

Tucker was also out of the city. But in a brief statement read by his press secretary, Alan F. Grip, the Council chairman said, "I am pleased with Judge Greeme's ruling. I believe my position in this lawsuit has been vindicated and that this matter has finally been put to rest."

Greene's cited four reasons for not removing Tucker, despite the violation. First, he said, although Tucker begin teaching at Howard in 1975, he stopped teaching there May 31, and removal now could be viewed as a "penal" action. Second, said Greene, the city had oot asked for the removal until June 6 - more than two years after Tucker first begin teaching at Howard and after he had decided to relinquish it.

The judge also said that even though the employment at Howard was prohibited, Tucker reason to believe it was not, based on conversations the Council chairman had had with the key congressional members and staff persons who helped to frame the charter legislation.

Greene said Tucker's employment at the school and also as a lecturer for the nonprofit Washington Workshops Foundation, Inc. - jobs from which Tucker earned $20.250 over three years - did not violate the city's conflict-of-interest law.

Judge Greene, who heard oral arguments in the case Oct. 19, agreed almost unanimously with Risher that Tucker's work in Howard's School of Social Work was a violation of the charter.

"The language . . . is explicit," Greene wrote. "It prohibits any employment or the holding of any position for compensation.

"It could be argued that the law should be otherwise . . ." Greene wrote later, "But that is a matter for the Congress, not this Court."

Tucker's lawyers had asserted that in the legislative proceedings leading up to passage of the charter by Congress, a "position" was interpreted to mean something that took away from the duties of the chairman, who is paid an additional $10,000 to work full-time for the city. (The Council's other 12 members are considered part-time employees.) The Howard post did not prevent Tucker from carrying out his public tasks, the lawyers said.

Greene said that ordinarily such legislative history would not even be considered, but because of the vast public interest in the case, it should. "The legislative history buttresses the conclusion that the Council chairman was to have no outside public or private employment or position," Greene wrote.

Tucker's lawyer had also argued that the chairman had been assured that his work at Howard would not be included in the prohibited activities. But no such exception to the rule exists, Greene said.

"Assuming that the law could somehow be deemed to include an exception for teaching, writing or lecturing, the only reasonable construction would be to apply it to occasional exercise of these pursuits and for relatively nominal compensation," he wrote.

Tucker was an adjunct professor at the school and regularly taught a graduate class.

After news of Risher's probe was first reported. Tucker based his defense in large pajrt on a May 26 statement issued by Rep. Charles C. Diggs Jr. (D-Mich.), chairman of the House District Committee, and Sen. Thomas F. Eagleton (D-Mo.), chairman of the Senate District Committee.

The two congressmen said that although it was their feeling at the time the legislation was passed that the City Council chairman's job would be full-time, and that that requirement could be met by the chairman putting in a full day's work, "it was not intended to preclude income made by writing, lecturing or making speeches," they said.

Later, in sworn testimony taken for the case, Tucker acknowledged that he had never spoken with Eagleton about his Howard job and most of the assurances from Diggs had actually come through private talks with Robert B. Washingtn Jr., who was then chief counsel to the Diggs committee.

"There is considerable doubt whether any of these materials may properly be considered by the court," Greene wrote. "The family established rule is that legislative history must be both contemporaneous and public."

It was only in Risher's contention that Tucker had violated the public trust and should automatically be ousted from office that Greene departed from his agreement with Risher.

Risher had contended that since Tucker had been working at Howard ever since Jan. 2, 1975 - the day the chairman was sworn in - Tucker had forfeited his right to hold office.

"If the facts are undisputed, the law is automatic. What room is there for discretion?" the corporation counsel asked during oral arguments.

But Greene said that "failure to maintain a particular qualification does not itself bring about a forfeiture of office . . . The theory that the defendant never was de jure chairman because he also engaged in some outside activities is too tenuously artificial for serious consideration.

The judge instead said that the court does have a choice of whether or not to order Tucker's removal, and in this case it would not.

Risher's final contention, which developed only after the first court papers were filed, was that Tucker had violated the city's conflict-of-interest law. This assertion was based on the fact that many of the tasks for which Tucker was paid were, in Risher's opinion, part of his ordinary duties as Council chairman.

Greene said that there was no conflict of interest, however, because none of the sources from which Tucker received money stood to benefit financially from legislative actions that Tucker might take as chairman of the Council.

Tucker "received compensation for teaching and lecturing at a public university and a public educational institution with no taxes to grind," Greene wrote. "That is not the kind of conflict of interest that would cause a court to exercise its discretion in favor of removal from office.

Greene's decision is likely to be a clear political boost to Tucker, who has so far not announced his candidacy - in part because of the uncertainty of the outcome of this case.