James T. Farrell, 75, the author of the "Studs Lonigan" trilogy, a landmark of realism in American letters, died at his apartment in New York City yesterday after a heart attack.

The three "Lonigan" novels, a harrowing and explicit tale of the life and early death of a working-class Irish-American in Chicago, were published between 1932 and 1935. They brought to Mr. Farrell mixed success with the critics (some thought the books had been "reported" rather than "plotted"), a degree of notoriety, no great fortune despite the fact that the work has remained in print, and a place in American literature that is undisputed.

Even while he was writing "Studs Lonigan," Mr. Farrell was at work on other books. In all, he produced 52 volumes and was at work on others at his death. He wrote novels, short stories, poems and essays on criticism. He lectured and wrote newspaper and magazine stories. His most recent novel was "The Death of Nora Ryan," which was released in 1978.

Among them were two extended works, the "Bernard Carr" trilogy and the "Danny O'Neill" pentology. Like "Studs Lonigan," they were set in the lower-class Irish mileu of Chicago in the 1920s and 30s. Although both series met with substantial critical success, neither reached the popularity of "Studs Lonigan."

Studs was a boy whose father was in the paint business and whose mother wanted him to become a Catholic priest. Studs wanted the life of the pool halls. By the time of his death at the age of 29, dissipation had ruined his health. When he finally decided to get a regular job, he went looking on a rainy day, caught pneumonia, and died because of the weakened heart.

Danny O'Neill starts life in the same neighborhood as Studs. But he manages to get to the University of Chicago and is considering becoming a writer when the fifth book in the series ends. Bernard Carr follows a similar route and becomes a writer in New York.

Much of Mr. Farrell's work has a strong autobiographical element. But the principle that informs "Studs Lonigan" and his other books is that man is a product of his environment. Escape from one's environment, in Mr. Farrell's novels, is a matter of unremitting struggle.

Mr. Farrell was a Marxist by conviction. His idea that society determines the fate of individuals followed from his Marxism.At the same time, he did not permit ideology to intrude into his work. He was an opponent of Stalinism in the 1930s and of the dictatorship associated with that term.

He once said of his books, "The purpose of these works is, stated generally, to recreate a sense of American life as I have seen it, as I have imagined it, and as I have reflected upon and evaluated it."

He said he was part of the "naturalistic or realistic tradition." Leonard Kriegel, writing in The Nation in 1976, said that Mr. Farrell's characters "commit what must be the single, unforgivable sin left in America: They lead drab lives."

"A writer must be lonely," Mr. Farrell said in an interview in 1970. "I've mastered the art of solitude. I don't have a car. I never wanted one. The less I own, the better it is. One lecture bureau dropped me, and I think maybe it was my clothes."

Mr. Farrell did not control the movie or television rights to his work. So he made no money from a film version of "Studs Lonigan" or from a televition serialization of it that was broadcast earlier this year.

In an article in The Washington Post about the television series, which he generally liked, Mr. Farrell stated his theory of society and the individual and how he tried to put them together in his books.

"The realism of "Studs Lonigan" is far more harsh than the realism of television," he wrote. "To me, plot is secondary. I concentrate on creating the strongest possible sense of reality in my characters, and the background and general atmosphere of their lives. If a writer can achieve such reality, he can ignore prescriptions and most of the other roles that are declared essential for good and sound writing."

James Thomas Farrell was born in Chicago on Feb. 27, 1904. He was one of 15 children born to James Francis and Mary Daly Farrell. Only six of the children reached adulthood. He studied at DePaul University in Chicago and then switched to the University of Chicago, where he became interested in writing.

During his student days, he worked in a cigar store, a filling station and as a clerk in the American Railway Express office. In 1930, he went to Paris for a year and then settled down in New York City.

As a youngster, he had played football and baseball in high school. Baseball remained one of the enduring passions of his life. He used to say that one of his proudest moments was the time Paul Warner, a major leaguer, saw him swing a bat and said he like the way he did it. Even when he was almost broke (his income one year was down to $2,165) he would go to baseball games.

But wherever he was, Mr. Farrell stuck to his schedule of writing.

"I must conquer and control time and use it here at my desk," he wrote in The Washington Post in 1978, "Every writer faces this problem. There can be no excuse for wasting time. As a young man, I began to develop habits of work. I knew that to complete what I hoped to write, I would have to set a goal. I did -- 1,000 handwritten words or five typed pages a day. I have managed to maintain this average even while I've taken on brief teaching assignments, gone on lecture tours, or enjoyed the baseball season. A writer must be as self-disciplined as a staff sergeant. Or a general."

In the same article, Mr. Farrell described receiving a telephone call from a friend who said she liked his most recent book.

"This is my reward," he said, "the greatest reward that a writer can gain -- to reach others, to stir their minds, infect their feelings, and to

"This is my reward," he said, "the greatest reward that a writer can gain -- to reach others,to stir their minds, infect their feelings, and to remind them of our common pathos, its grandeur and wonder."

In 1958, Mr. Farrell began writing a cycle of fiction called "A Universe of Time." It was planned to include about 30 volumes, seven of which had been published by the time he died.

Mr. Farrell once wrote that "the work of an artist, or a thinker, is an answer to death . . . It is not simply the wish, but the determination to express thoughts that death cannot encompass or obliterate."

Mr. Farrell was married three times and divorced twice. He had been separated since 1958. His survivors include a son, Kevin, by his second marriage.