Frederic Dannay, 76, the cocreator of Ellery Queen and one of the most successful mystery writers of all time, died Friday at White Plains Hospital in White Plains, N.Y. He had diabetes.

Back in 1929, Mr. Dannay, then an advertising copy writer and account executive, and his cousin, Manfred B. Lee, a movie publicist, decided to enter a contest sponsored by McClure's Magazine to write a mystery novel. So they wrote "The Roman Hat Mystery," and it won. Before they could collect the prize, the magazine folded, but their effort was published as a book by the Frederick A. Stokes company.

Thus began the saga of Ellery Queen. The dapper and mannered son of a New York detective, whom he assisted on his cases, Ellery Queen was the chief protagonist of this and all subsequent adventures bearing his name. He also was listed as the author of the books about himself. In all, about 35 Ellery Queen novels and hundreds of short stories were written between 1929 and 1971.

It has been estimated that more than 150 million copies of Ellery Queen books have been sold, including anthologies and other compendiums. They have appeared in many languages. From 1938 to 1949, "The Adventures of Ellery Queen" were on the radio in a complicated format in which a panel of "experts" and the audience would be given the clues necessary to unravel the mystery. After a suitable period of discussion and guessing, the mystery was acted out and, behold, the culprit stood revealed. There were Ellery Queen movies and, later, Ellery Queen television programs.

In 1941, Mssrs. Dannay and Lee founded "Ellery Queen's Mystery Magazine." It has been called " 'The New Yorker' of the mystery story" because of the quality of work it has published. Not only did its contributors include such luminaries as William Faulkner, the Nobel laureate, and Katherine Anne Porter, but it was the goal and inspiration of new authors. It was the first to publish the work of about 500 successful writers.

"It is not too much to say," the critic Julian Symons has written, "that the continuation of the crime short story as we know it, like its development during the past twenty years, seems largely dependent upon 'Ellery Queen's Mystery Magazine.' "

All this is merely to say that Ellery Queen is a household name. That can hardly be said of Frederic Dannay and Manfred B. Lee, the creators, developers, guides and chroniclers of the cerebral sleuth and his various enterprises. That is surprising when one considers that, in the words of the critic Allen J. Hubin, "Few writers have made as great an impact on 20th century American detective fiction as Ellery Queen."

Mr. Dannay was born in Brooklyn, N.Y., on Oct. 20, 1905. His parents were Meyer H. and Dora Walerstein Nathan and they named him Daniel Nathan. Years later, Daniel Nathan legally changed his name to Frederic Dannay. He chose Frederic because of his admiration for the Polish composer Frederic Chopin. Dannay is a kind of acronym made from Daniel Nathan.

Shortly after "The Roman Hat Mystery" appeared in 1929, Mssrs. Dannay and Lee quit their jobs to devote full time to writing. Although the Great Depression was upon the land, they enjoyed immediate success.

They came to pick the name Ellery Queen because Ellery was the best friend of Mr. Dannay's boyhood. They picked Queen because it sounded fine after Ellery. They decided to make Ellery Queen the author of their books as well as the hero to get double exposure of his name.

In the early 1930s, they also wrote under the joint pseudonym of Barnaby Ross, author of such mysteries as "The Tragedy of X" and "The Tragedy of Y." These books also were successful and later were reissued under the name of Ellery Queen.

In the early days, Mr. Dannay and Mr. Lee tried to keep the true identity of Ellery Queen a secret. They wore masks when they gave lectures, Mr. Dannay impersonating Queen and Mr. Lee taking the part of Ross. The secret got out in the late 1930s in connection with a Hollywood promotion.

The two cousins did much of their work in their respective homes. They would iron out differences and coordinate plot in a small office in New York. The location of this hideaway was said to be unknown even to their wives. They continued their collaboration until 1971, when Mr. Lee died. Mr. Dannay continued to edit "The Ellery Queen Mystery Magazine" until his death.

Mr. Dannay was a visiting lecturer at the University of Texas in the early 1970s and donated to the school his vast and important collection of crime and detective stories. His honors included five Edgar Allan Poe Awards, an honorary doctorate from Carroll College, and, in 1979, the 50th anniversary of Ellery Queen, the Grand Prix de Litterature Policiere for "And On the Eighth Day," which appeared in 1964.

Mr. Dannay's first wife, the former Mary Beck, died in the 1940s. His second wife, the former Hilda Wiesenthal, died in 1972.

Survivors include his wife, the former Rose Koppel; two sons by his first marriage, Richard of New York City, and Douglas of Merrick, N.Y., and three grandchildren.

A bald, retiring man of stocky build and medium height, Mr. Dannay said in an interview with The Washington Post at the International Congress of Crime Writers in New York in 1978 that he did not like public appearances.

"I've done everything I can to cure myself, but nothing works," he said.

However, there was no sign of this reticence when he addressed a group on the subject of "slush," which is a trade term for unsolicited manuscripts.

"Every story submitted must be read," he declared, possibly keeping in mind how he and Mr. Lee got started. "The importance of slush cannot be overestimated. The slush pile represents the lifeblood of the future. Who else will take the place of the so-called old-timers?"

No one suggested that anyone ever would take the place of Frederic Dannay or Ellery Queen.