Mayor Marion Barry yesterday appointed James E. Clay, the head of the Kansas City, Mo., housing authority and a former D.C. official, as the new director of the Department of Housing and Community Development.

Clay, 45, will replace Robert L. Moore, who stepped down from the $56,300-a-year post last November to become a special consultant to the city government in charge of most of the city's most important development projects. Madeline Petty served as acting director of the department until Barry found a permanent replacement for Moore.

As Moore's deputy from 1979 to 1982, Clay developed a reputation as an able and well-liked troubleshooter. Last March he left Washington to accept the $55,000-a-year job as executive director of the Kansas City Housing Authority. The Kansas City agency recently agreed to release Clay from a one-year personal-service contract, and he said he expects to begin work here March 1.

"Mr. Clay brings to this position extensive experience with community development and housing programs, both at the local and the national level," the mayor said in making the announcement.

Reached by telephone in Kansas City yesterday, Clay said he intends to devote most of his energy to improving the city's 11,500 units of public housing--many of which are long overdue for repairs or renovation.

"The most attractive thing I find about working for Washington is Mayor Barry's real commitment to improving public housing," Clay said. "Washington is the only city that actually uses its own local funds to improve federally funded public housing."

Clay, who is married and has two children, graduated from Knoxville College in Tennessee and received a master's degree in public administration from American University.

Before joining the D.C. housing agency in 1977, Clay was an area director for the U.S. Department of Housing and Urban Development. He also served as an executive of the National League of Cities and U.S. Conference of Mayors.