A controversial, gun-toting state judge testified today that he had secretly issued court orders granting himself the right to carry a pistol because he feared assassination.

"It was my intention that no one know that I carried a defensive weapon," Judge Pierre E. Dostert told a judicial ethics panel during an unprecedented hearing here. He asserted that any disclosure of his practice of carrying a handgun would have been "an invitation for somebody to employ. . . a high-powered weapon with a scope" to kill him.

The tough-talking, stocky 46-year-old judge is accused of violating ethical canons by illegally carrying a revolver and by interfering in a criminal investigation stemming from a March helicopter incident in nearby Harpers Ferry.

In his testimony yesterday, Dostert contended that he needed to carry a revolver "because of the numerous threats I received upon my person, both verbal and physical." He also complained that his courtroom often lacked adequate security.

Several law enforcement officals, called as witnesses by Dostert's lawyer, Richard L. Douglas testified that they had urged the judge to carry a weapon for self-protection, partly because of his reputation as a stern law-and-order advocate.

Dostert, a former Washington lawyer who was elected to the bench three years ago, is the first West Virginia circiut court judge to be prosecuted for alleged ethical infractions by the state's Judicial Inquiry Commission. A judicial review board of three judges and two lawyers conducted today's hearing. It is not expected to make its recommendations for at least six weeks.

Dostert has denied the charges against him and has continued to preside at the Jefferson County Circuit Court here. The Judicial ethics panel is empowered to recommend disciplinary actions -- including possible suspension from the bench -- to the West Virginia Supreme Court. The panel gave no indication today how it would rule on the charges against Dostert.

A small crowd gathered on a rainy morning to observed the three-hour hearing at Charles Town's historic courthouse, where abolitionist John Brown was convicted of treason and sentenced to hang 120 years ago.

The incident that led to the proceedings, called the "copter caper" by townsfolk, took place March 25, when Dostert joined Harpers Ferry police to arrest three persons including a pilot who allegedly landed a helicopter in a vacant lot in the town in violation of a local ordinance.

Dostert, wearing a trench coat over his pajamas, allegedly thrust his .38-caliber snub-nosed revolver into the chest of Detlev Preissler, an art gallery owner, and shouted, "This is America; I am the judge; this is my warrant as I am the law."

Although this much-publicized incident triggered the proceedings against Dostert, it was only touched on briefly during the hearing. Several Preissler family members were in the courtroom audience and complained bitterly afterward that they had not been called as witnesses against Dostert. bDetlev Preissler termed the hearing "a whitewash."

Much of the hearing centered on a key point of dispute-whether Dostert held a valid license to carry his revolver.

Dostert contended that he had a valid firearms license because he had secretly issued two court orders granting himself pistol permits. He testified that he typed the documents himself and kept them under seal, locked in his desk.

The judge acknowledged that several conflicting dates appeared on the documents, but attributed the discrepancies to typographical errors and a lapse in memory. When asked about a 1977 firearms order he claimed to have secretly issued, Dostert acknowleged "I don't have that permit." He gave no explanation for what happened to it.

Charlotte R. Lane, the Judicial Inquiry Commission's attorney, argued that the judge's secret orders did not constitute valid firearms permits and were an unethical attempt to "circumvent" West Virginia's firearms law.