NEW YORK, DEC. 12 -- A federal judge today ordered a Jan. 3 trial for a former Iran-contra prosecutor's attempt to publish a "blow-by-blow account" of the investigation over the objections of independent counsel Lawrence E. Walsh.

U.S. District Judge John F. Keenan ordered Walsh's office to set out all its complaints about the book, line by line, by Friday in a sealed submission. Briefs are due next week.

The judge also ordered the author, Jeffrey Toobin, now a federal prosecutor in Brooklyn, to produce copies of the "diaries" he kept during his 2 1/4 years with Walsh's office as well as any documents he may have taken with him.

After a hearing this morning, Keenan indicated he would try to resolve all of the issues here, but he reserved ruling on a request by Walsh's office to have a major aspect of the case -- dealing with grand jury secrecy -- decided in Washington by the judge who supervised the Iran-contra grand juries. Keenan said he would rule on this question Dec. 26.

The dispute appears to be not so much over what the book says, but when it comes out. Its title is "Opening Arguments: A Young Lawyer's First Case -- United States v. Oliver North" and the publisher, Penguin Books USA Inc., wants to distribute 300 galley copies to reviewers and send 20,000 to 30,000 hardcover copies to bookstores by February.

Walsh apparently wants to fend off publication until he makes his final report and until the North case, now on appeal to the Supreme Court, is settled, probably sometime next spring.

Walsh's lawyer, Guy Struve, contended that Toobin and Penguin are attempting to "stampede" the court "into a pell-mell resolution" of the case by manufacturing an emergency situation. Struve said they could have filed suit months ago since the publication date was fixed by last July.

Toobin signed a nondisclosure agreement with Walsh's office on leaving the job in May 1989, pledging not to disclose "grand jury" or "investigative" material without written approval.

The 30-year-old author and Penguin filed suit Nov. 28, claiming that Walsh had threatened them with criminal prosecution after more than a year of futile negotiations. They asked for an injunction preventing Walsh from taking any further action and for a decree stating that Toobin had not violated the grand jury secrecy rule or any contractual or fiduciary obligation.

Keenan said Walsh was entitled to inspect Toobin's diaries and other materials to determine whether he included in his manuscript "nonpublic information which he was under a duty not to disclose."

Toobin and Penguin's lawyers asserted today that Toobin can show independent sources for matters that Walsh may claim violate the grand jury secrecy rule. They have also contended that Walsh has been improperly invoking the rule to prevent disclosure of "as much of the ordinary business of {Walsh's office} as possible."

The new Penguin catalog bills the book as "an insider's blow-by-blow account of how government lawyers build and then try a major criminal case." It says Toobin will tell "why {former national security adviser} Robert McFarlane was allowed to plea bargain" and "why {former assistant secretary of state} Elliott Abrams wasn't charged with a crime."

Struve argued at today's hearing that grand jury issues should be decided separately by Chief U.S. District Judge Aubrey E. Robinson Jr. in Washington since he supervised the Iran-contra panels.

Toobin lawyer Robert H. Baron protested that this would impose an "enormous" financial burden on Toobin and hand Struve a victory by slowing the litigation. Baron and Penguin lawyer Martin Garbus argued that Keenan would be able to decide the case swiftly "as a matter of law" once Walsh lists his objections.