Thorsten V. Kalijarvi, 82, former U.S. ambassador to El Salvador who had served earlier as assistant secretary of state for economic affairs, died Thursday at Mount Vernon Hospital after a heart attack.

He and his wife, Dorothy Knight Kalijarvi, had come from their home in Barnstable, Mass., in May to visit their daughter, June D. W. Kalijarvi Conway of Alexandria.

Dr. Kalijarvi was ambassador from 1957 to 1961 when he became a consultant to the State Department. He retired that same year and moved to Barnstable.

He first came to Washington in 1947 as principal analyst for European affairs at the Library of Congress, serving at the same time as staff assistant and consultant to the Senate Foreign Relations Committee. In 1950, he was named senior specialist in foreign affairs at the Library.

He joined the State Department three years later as deputy assistant secretary of state for economic affairs, was assistant secretary in 1957 and acting under secretary in 1956-57.

Dr. Kalijarvi was born in Gardner, Mass. He was a graduate of Clark University in Worcester, Mass., where he also received a master's degree in 1923 after attending Harvard University as a Carnegie Endowment fellow. He received a doctorate in 1935 from the University of Berlin. He also had attended the Hague Academy of International Law and the Geneva School of International Studies.

From 1927 to 1945 he was head of the political science department at the University of New Hampshire and a professor of government. He also worked for several New Hampshire government agencies before coming here. After leaving Washington, Dr. Kalijarvi served with several committees with the U.S. Chamber of Commerce. A former lecturer at American and Johns Hopkins universities, he taught at Pennsylvania State University for several years and was dean of the faculty of Cape Cod Community College.

He was the author of a number of books on foreign policy, contributor to various journals and the editor of a number of pubications.

Dr. Kalijarvi was a fellow of the American Academy of Sciences and the American Association for the Advancement of Science. He belonged to the American Society of International Law, the American Political Science Association, The National Academy of Economic and Political Science, the Washington Institute of World Affairs, the Cosmos Club and DACOR.

In addition to his wife and daughter, he is survived by a sister, Alfihld K. Wuorinen of Gardner, and a granddaughter.