Alexandria City Manager Douglas Harman has reinstated Harland K. Heumann, whom he fired two months ago as second in command of the Alexandria Redevelopment and Housing Authority, avoiding the possibility of a lengthy and expensive lawsuit.

Under an agreement worked out between the two men, Heumann will continue as deputy executive director of the agency until May 31, when he will go on leave until he retires April 8, 1981. Heumann's $45,000-a-year salary will continue until the date of his retirement.

Harman and Heumann have battled privately for years over control of the agency, which manages 1,000 public housing units in the city and has an annual budget of $2.8 million.

Heumann, 59, who has worked for the city for 29 years, declined comment yesterday. His attorney, David Rosenfeld, said, "we are reasonably satisfied with the arrangement." He said a lawsuit contesting the firing last Dec. 19 now will be unnecessary.

Heumann headed the agency from 1966 to 1977, when it functioned as an independent body without city control. In 1977 Harman engineered a restructuring of the agency to bring it under city control, and was appointed its executive director. Heumann was demoted to deputy executive director and put in charge of day-to-day operations.

When Harman fired Heumann, sources said he had become "fed up" with his inability to obtain information from Heumann and was disturbed at what he regarded as poor maintenance of the city's public housing projects and an ineffective rat control program.

Under the agreement, Heumann will work on unspecified special projects until next May, and assist with transferring of operations to new personnel. His successor has not been named.