A federal judge yesterday ordered Lt. Col. Oliver L. North to testify, under a limited grant of immunity from prosecution, before the congressional committees investigating the Iran-contra affair.

U.S. District Court Judge Louis Oberdorfer, the court's acting chief judge, signed the order granting North limited or "use" immunity from prosecution.

The order, sought by the House and Senate committees. directs North, a former National Security Council aide, to give testimony that he had refused to provide another congressional panel late last year.

Panel lawyers this weel are to take depositions in private from North and former national security adviser John M. Poindexter.

Use immunity was also granted yesterday to Glenn Robinette, a former Central Intelligence Agency official who installed a security system at North's home in Great Falls, Va.

Congressional sources said the panels are trying to determine whether Robinette was paid for the work from a secret Swiss bank account controlled by retired Air Force major general Richard V. Secord. Secord has denied any such connection.

Early this month, the House and Senate panels rejected a request by independent counsel Lawrence E. Walsh that they not grant North immunity, which would prohibit prosecutors from using any resulting congressional testimony by North as evidence against him.

The panels agreed, however, to put off public testimony by North until at least July 16.