The long search for a national archivist ended yesterday with the selection of a University of Michigan historian to head the National Archives.

The appointment of Robert M. Warner to the $50,012-a-year position was announced by General Services Administrator Rowland G. Freeman III. Warner, 52, director of the Bentley Historical Library at the University of Michigan, was one of several candidates for the post recommended by a search committee.

In announcing the appointment, Freeman hinted at the controversy that erupted between him and many historians last winter when he announced controversial plans -- later suspended -- to decentralize many records currently housed by the government in Washington.

"I will rely heavily on Dr. Warner for the efficient and effective management of the National Archives Records Service and for maintaining a dialogue with users so archival programs can continue to be tailored to best meet their needs," Freeman said.

The archivist post has been vacant since August 1979, when James B. Rhoads resigned.

The archives, which has an $80 million budget and 2,500 employes in Washington and elsewhere, has been a center of controversy for the past year. Federal investigators and Freeman have accused the office of sloppy management.

Freeman, meanwhile, has been accused of barging into a national cultural institution and proposing unrealistic management procedures. The archives are part of the General Services Administration which Freeman run.