William L. Langer, professor emeritus of history at Harvard University, who was a U.S. intelligence officer and adviser during World War II, died Monday at the New England Baptist Hospital in Boston. He was 81.

Dr. Langer was Coolidge professor of history at Harvard from 1936 until he retired in 1964. During this time he wrote more than a dozen books on European diplomatic and Middle Eastern history and served a one-year term as president of the American Historical Association.

During World War II, he became chief of the research and analysis branch of the Office of Strategic Services (OSS). Earlier in the war, he had worked as a member of the board of analysts in the Office of the Coordinator of Information in 1941 and 1942.

Dr. Langer continued his work in intelligence after World War II, serving as assistant director for national estimates with the Central Intelligence Agency from 1950 to 1952. He was a member of the President's foreign intelligence advisory board from 1961 to 1969.

As a historian, Dr. Langer was known for his early advocacy of what came to be known as "psycho-history." In his 1957 presidential address to the American Historial Association he caused something of an uproar by arguing that historians should explore modern psychology.

"Nowadays, it almost goes without saying that biography, whether literary or historical, must take moden psychology into account," he said at a conference on psychology and history at the Graduate Center of the City University of New York in 1971.

Dr. Langer became interested in the application of phsychology to his historical work through the influence of his brother, Walter C. Langer, a psychoanalyst. It was the intention of the brothers to write a diplomatic history of Europe in the 19th and 20th centuries combining the tools of the conventional historian with those of the psychologist and psychoanalyst. Their purpose was to explain some of the events of diplomacy through the psychological make up of some of the larger historical figures.

The book never was written, because World War II interrupted. A by-product of this embryonic collaboration was Walter Langer's "The Mind of Adlof Hitler," a study of Hitler's life done for the OSS during the war. (The book was classified for security reasons and was not issued to the general public until 1972, when it became a best-seller.)

The major works of Dr. Langer, the history professor, include the "Encyclopedia of World History," first published in 1940 and now in its sixth edition, "European Alliances and Alignments 1871-1890," "The Rise of Modern Europe," "The Diplomacy of Imperialism," and most recently, "Political and Social Upheaval, 1832-1952" published in 1969. and "Our Vichy Gamble" which came out in 1971. His autobiography. "In and Out of the Ivory Tower," is scheduled for publication.

Dr. Langer was born in Boston and Earned bachelor's, master's and doctor's degrees at Harvard University. From 1923 to 1927, he taught at Clark University in Worchester, Mass. He returned to Harvard as an assistant professor in 1927.

Among the other schools at which Dr. Langer taught were Yale University, the University of Chicago, Columbia University, and the Fletcher School of law and Diplomacy at Trufts University.

Besides teaching, he also was director of the Russian Research Center and Center for Middle Eastern Studies at Harvard and a fellow of the Center for Advance Study in Behavioral Sciences, also at Harvard.

Dr. Langer served in the Army in France in World War I.

In addition to his membership in the American Historical Society, he was a member of the Society of American Historians, the Academy of Arts and Sciences, and the Council on Foreign Relations.

Dr. Langer is survived by his wife, Rowena, of the home in Cambridge, Mass.; two sons; four step-children; 15 grandchildren; two great-grandchildren, and his brother, Walter C., of Sarasota, Fla.