Jefferson W. Lewis will retire Dec. 31 after nearly two years as District of Columbia fire chief -- a term marked by uneasy relations with both rank-and-file firefighters and top officials of the Barry administration.

With no clear lines of succession to the $50,112-a-year post, Mayor Marion Barry said he may go outside the Fire Department to find a new chief.

Barry announced the impending departure of the 60-year-old Lewis as a voluntary retirement after 32 years of service. But sources in the city government said that Lewis decided to retire when it became clear Barry would not extend his term beyond next March.

While retirment at age 60 is not mandatory under city law, members of the fire and police departments reaching that age who want to remain on duty must request and receive approval from the mayor. Lewis got a one-year extension from Barry on his 60th birthday last March.

Lewis was appointed fire chief by former Mayor Walter E. Washington in March, 1978 despite opposition from two major organizations representing the city's rank-and-file firefighters.

Spokesmen for both groups made it clear yesterday that they will not be sorry to see Lewis depart.

"That's good news," William Hoyle, president of the Fire Fighers Association, and AFL-CIO affiliate, said when told of the retirement announcement. "Oh, no, I didn't mean to say that," he added hastily.

The union has supported several other candidates for fire chief over Lewis. Later in 1978, the union endoresed Barry for the Democratic nomination for mayor over both Washington and Sterling Tucker.

Hoyle said the union "did not agree with some of his (Lewis') policies . . . There were a lot of little things . . . he was kind of set in his ways."

The union represents about 1,150 of the department's 1,400 uniformed personnel, Hoyle said.

Theodore Holmes, president of the Progressive Firefighters Association, a group (but not a union) that represents most of the 400 blacks in the department, said "there were occasions where we had to talk to the mayor about decisions the chief has made -- promotions, directions, overall leadership.

"we never really had a meeting of the minds with the chief," Holmes said. "More of our meetings ended with an agreement to disagree than an agreement to agree."

Hoyle said the association will push for the appointment of a black successor to Lewis.

Close advisers to Mayor Barry often found themselves uneasy in dealing with Lewis. Some said he did not convey the activist image the mayor had tried to set for his administration.

But with the department retaining its Class A rating among big-city fire departments, Barry was reluctant to remove a chief who had doggedly worked his way to the top in the segregation era, becoming one of the first black battalion chiefs in 1970.

The department's No. 2 man now is John P. Devine, assistant chief for operations, who is white and who was one of several candidates endorsed for the job when it went to Lewis.

David A. Clarke (D-Ward 1), chairman of the city Council's Judiciary Committee, which has supervisory jurisdiction over public safety matters, said yesterday that he hoped Barry would name Devine to the post.

The possibility that Barry may go outside the department for a new chief was raised during a brief discussion with reporters.

The mayor was asked whether the new chief would come from inside the department. "I don't know," the mayor replied. Barry said he and city administrator Elijah B. Rogers are "working on" finding a replacement.

Union leader Hoyle said "we are hoping it (the appointment) is from the inside." But Holmes said the Progressive Firefighters would not object to choosing an outsider who is a good administrator.

Barry's letter accepting Lewis' retirement request said it was being accepted "with great regret." He credited the chief with contributions that put the department in the front ranks of fire departments nationally.