Richard V. Secord, a major figure in the Iran-contra affair, has taken the unusual step of asking a federal court to force independent counsel Lawrence E. Walsh to allow him to appear before a federal grand jury to try to persuade jurors that they should not indict him, according to a previously sealed motion made public yesterday.

Secord said in the motion that Walsh had denied his request to testify in his own defense because the retired Air Force general wants to tell grand jurors about immunized congressional testimony on his behalf that was given last summer by former White House aides Oliver L. North and John M. Poindexter.

Walsh believes that potential indictments against North, Poindexter and others would be tainted if Secord were allowed to tell grand jurors about congressional testimony that was given on the condition that it could not be used toward any indictments, according to attorneys familiar with the investigation.

These sources said that Walsh has been willing to allow Secord to appear before the grand jury only if he agrees to answer the questions put to him and does not volunteer information that would include the immunized testimony of others. Secord, alone among the major figures of the scandal, testified without a grant of immunity before the House and Senate committees investigating the affair.

Chief U.S. District Court Judge Aubrey E. Robinson Jr., in unsealing Secord's motion, set no date for a hearing or a ruling on the issue, a spokesman said. Some attorneys said they believe that the matter is without precedent.

Secord, in papers filed by defense attorney Thomas C. Green, said that he deserves the freedom to present his own statement to the grand jury and contends that Walsh, as any prosecutor, has the duty to present exculpatory evidence to grand jurors before they vote on any indictment.

Secord, who retired from the Air Force in 1983 with the rank of major general, was recruited by North to run the so-called "enterprise" that sold weapons to Iran and funneled profits to the antigovernment rebels in Nicaragua, according to congressional testimony. Some officials described him as North's top assistant for logistics.

Sources close to the case have said that Walsh will seek indictments in the next several weeks against North, Poindexter, Secord and Albert A. Hakim, an Iranian-born U.S. businessman, on grounds that they took part in a far-reaching conspiracy to violate a congressional ban on military aid to the contras, to defraud the U.S. government of proceeds from the arms sales and to obstruct justice. Others also may be charged, the sources said.

A spokesman for Walsh said that the court-appointed prosecutor had no comment on Secord's motion pending release of legal papers that Walsh submitted under seal to Robinson.