D.C. Corporation Counsel John R. Risher Jr. urged a federal judge yesterday to uphold a law that requires Marion Barry Jr. to resign from the City Council in order to run for mayor.

Risher, an appointee and close associate of Mayor Walter E. Washington, took the position in a 29-page brief filed in U.S. District Court in answer to a lawsuit filed in January by Barry.

The filing set the stage for oral arguments in the case April 17 before Judge Gerhard E. Gesell.

Barry is one of three Democrats who have said they will seek the Democratic nomination for the mayoral post now held by Washington, who is expected to seek reelection.

At issue is provision of the city's congressionally enacted Home Rule Charter. One provision says no elected official may run for another D.C. office unless his present term expires before the term of the new office starts. Barry's council terms ends in 1981. The next mayor's term begins Jan 2, 1979.

Under a rule tentatively adopted last week by the D.C. Board of Elections and Ethics, Barry would have to resign from the council no later than July 5.

Barry's lawyers contend that the law unconstitutionally deprives him of fundamental legal rights, and deprives voters of the rights to choose him as a qualified candidate as well as their right to continue to be represented by him on the council if he loses his bid for mayor.

Risher's brief contended that the law is valid, partly because it would permit voters to elect a successor to Barry on the council on the same day - Nov. 7 - as the general election for mayor. That would save the city the cost of a special election, the brief contended. The last such election, in 1977, cost $134,998.

Moreover, the Risher brief said, the law encourages an incumbent official to devote full time and attention to public duties instead of running for office.