Erich Fromm, 79, a psychoanalyst and philosopher who sought to apply the lessons of psychology to the social and political problems of the 20th century, died of a heart attack Tuesday at his home at Muralto, Switzerland.

Among the most widely read social theorists of his day, Dr. Fromm also was among the most prolific and eclectic of writers on the nature of man and his relationship to the environment. His topics ranged from the theories of Karl Marx and Sigmund Freud to Christianity and Judaism, from the nature of love to the need for broader understanding between the United States and the Soviet Union lest civilization end in a nuclear holocaust.

In 1956, he published "The Art of Loving," which proclaimed that "love is the only one sane and satisfactory answer to the problem of human existence." The love of which he speaks is not based upon superficial considerations such as beauty or sex appeal, but is a mutually satisfying relationship "under the condition of preserving one's integrity."

The book had an enormous vouge on campuses during the 1960s and Dr. Fromm became something of a cult figure among large numbers of students at that time. b

His most influential work may have been "Escape from Freedom," published in 1941. It is still in print. Dr. Fromm traces social development from the Middle Ages to modern industrial society. Having gained a substantial measure of personal freedom through the struggles of earlier generations, modern man finds himself faced with the dehumanizing demands of the technological age. By applying the techniques of psychoanalaysis to social change, Dr. Formm arrives at the conclusion that man tends to seek relief from contemporary conditions by embracing such authoritarian doctrines as Nazism.

Indeed, the relationship between man and modern society was a central concern in Dr. Fromm's thinking. In "The Sane Society," published in 1955 and one of his most influential works, he argued that man had become a virtual prisoner of the technology and the attendant consumer-oriented values that he had created. He called for a new era of "Humanistic Communitarian Socialism" in which man would be restored "to his supreme place in society."

Although a traditional Freudin by training Dr. Fromm broke with the founder of psychoanalysis on the question of environment versus inner drives as the well-spring of human behavior. Where Freud held that the unconscius is supreme in these matters, Dr. Fromm emphasized the social and economic factors. This led him to extensive studies of Marxism and the writings of its founder.

Dr. Fromm was an organizer in 1957 of the National Committee for a Sane Nuclear Policy (SANE), the name of which was based on "The Sane Society."

In 1961, he published "May man Prevail? An Inquiry into the Facts and Fictions of Foreign Policy."

The Cold War, Dr. Fromm wrote, is the product of misunderstandings in both the United States and the Soviet Union. The true danger to world peace, he said, came from Germany, which he claimed to be under the same influences that had led to Nazism. He envisioned the two superpowers cooperating to achieve universal disarmament and joining in the development of a bloc of unaligned nations to act as counter-weight to Moscow and Washington.

Dr. Fromm continued to write until shortly before his death. He published another book on Freud last year and had undertaken a new study of psychotherapy since then.

His other books included "Psychoanalysis and Religion,' "Heathy Soceity," "The Forgotten Language," "Sigmund Freud's Mission," "The Dogma of Christ and Other Essays on Religion, Psychology and Culture," "Revolution of Hope," "Social Character in a Mexican Village" (with Michael Maccoby). "The Anatomy of Human Destructiveness," and "To Have or To Be."

Erich Fromm was born in Frankfurt-am-Main, Germany, on March 23, 1900. His parents were Naphatli Fromm, a wine merchant, and Rosa Krause Fromm. He earned a doctorate at the University of Heidelberg in 1922 and took further training in psychoanalysis at the University of Munich. 1He completed his training as a psychoanalyst at the Psychoanalytic Institute in Berlin, becoming one of the relatively few persons to enter his profession without a degree in medicine.

The outbreak of World War I in 1914 was one of the profound experiences of Dr. Fromm's life. "For me, the First World War was the beginning of the process of brutalization that continues to this day," he told an interviewer in 1962.

When he was 26, Dr. Fromm, although descended from a long line of rabbis and the product of a devout Jewish upbringing, abandoned Judaism. "I gave up my religious convictions and practices because I just didn't want to participate in any division of the human race, whether religious or political," he said, in the same interview.

Dr. Fromm was a lecturer on psychonalysis at the University of Frankfort from 1929 and 1933. He was in Geneva, Switzerland, when Hitler came to power in Germany. He visited Chicago in 1933 and the following year decided to emigrate to the United States.

For the next three decades, he was on the faculties of a number of American universitites, including Columbia, Yale and Bennington College. He joined the faculty of the University of Mexico in 1951 and held a teaching post at New York University at the same time. From 1958 to 1962, he was professor of psychology at Michigan State University. He was a founder of the William Alanson White Institute in 1946.

He had lived in Muralto, a suburb of Locarno, Switzerland, since 1969 and last year received the rare accolade of honorary Swiss citizenship.

Dr. Formm's first marriage, to the former Frieda Reichmann, ended in divorce. His second wife, the former Henny Gurland, died in 1952. Survivors include his third wife, the former Annis Freeman, whom he married in 1953.