James M. Cain, 85, the best-selling author who was the poet of the hard-boiled school of the American novel, died Thursday after collapsing at his home in University Park.

After attempts at resuscitation faded, Mr. Cain, who came here about 30 years ago from Hollywood, was taken to Prince George's General Hospital, where he was pronounced dead on arrival.

Although he wrote almost 20 novels, Mr. Cain is best remembered for three - "The Postman Always Rings Twice" (1934); "Double Indemnity" (1936), and "Mildred Pierce" (1941).

The books, all of which were made into highly successful movies, contained action, a certain amount of violence and probably as much sex as the conventions of the 1930s and early 1940s would abide.

The books were written in a gruff, direct style that embodied the forcefulness of uncluttered colloquial speech and gave it the unobtrusive grace of good poetry.

Taut and spare, the books were written with a terseness that reminded many critics of Hemingway. At the same time, Mr. Cain's work was so compellingly readable that many critics of the '30s and '40s seemed to take it almost for granted that the work consisted of all surface and no substance.

That judgment would appear open to question. Mr. Cain's best books seem to portray a California characterized by an underlying rootlessness and restlessness that writers of the '70s still struggle to capture.

And against this background, Mr. Cain's characters play out their destinies, teased, tempted and finally consumed and destroyed by a greed that may be universal.

The language that led Edmund Wilson to suggest that Mr. Cain was the poet of the potboiler was the language of Mr. Cain's own speech.

People talk about my characters being tough," he once told an interviewer, "but all my guys are a bunch of yellow-bellied rats. I thought if I ever met Hemingway I would ask him 'How long do you boil them to make them so tough?'"

Mr. Cain was born in Annapolis, the eldest of five children and the son of a mother who was a singer and a father who was a aprofessor at St. John's College.

His father later became a president of Washington College in Chestertown, Md., where Mr. Cain received his B.A. in 1910.

As an 18-year-old college graduate, he once recalled, he "moved quickly from one job to another and lost most of them." At 21, he decided to be a singer but gave that up. He obtained a master's degree from Washington College in 1917 and soon after went to work for first the Baltimore American and then The Baltimore Sun.

During World War I, he served in the Army in France, editing an Army weekly. Later, he returned to The Sun and then, in the late 1920s, he wrote editorials for the prestigious New York World.

He contributed articles to H. L. Mencken's American Mercury, began writing plays and absorbed drmatic technique under the tutelage of play-doctor Vincent Lawrence.

At the same time, it was clear, Mr. Cain was developing - not necessarily from reading other novelists - the skill as a stylist that made him unique.

In the style that was inimitably his own, he explained: "I don't read other novelists, because I'm afraid I'll start writing like those guys."

it was a candid style, well-suited to a candid man.

After the success of his early work, Mr. Cain spent about 20 years in Hollywood as a screenwriter.

"Don't get the idea that writing for the movies is easy money," he said."It ain't. But I wanted the money."

In 1949, he and his wife left the West Coast, where he said he once had tried "to drink up Hollywood." They came to the Washington area so Mr. Cain could do research in the Library of Congress for one of his novels - MIgnon.

While Mr. Cain sought in his pages the "quick, half improvished" effect of the way people speak, his plots and backgrounds were carefully constructed, highly detailed and anything but improvised.

In University Park, life for Mr. Cain proceeded at a slower pace than in his Hollywood days. "Mignon did not appear until 1962 and was "a bust from beginning to end," Mr. Cain said.

However, he continued to write, not only novels but also many letters to the editor. He also contributed occasional articles of reminiscence to The Washington Post and Potomac Magazine.

His wife died in 1966, and he had lived alone since then. He suffered a heart attack in 1968, and neighbors had kept a protective eye on him since then.