BURLINGTON, Vt. (AP) _ A federal judge today ordered three men of Lebanese descent detained on explosives charges after they were arrested crossing the border from Canada into Vermont.

U.S. Magistrate Jerome Niedermeier scheduled a Wednesday hearing for the men, identified as Walid Nicolas Kabbani, Walid Majib Mourad, and Georges Fouad Nicolas Younan, all Canadian citizens of Lebanese origin.

U.S. Attorney George Terwillliger asked that the men be detained without bail because they ''represent a substantial danger to the community.'' He added that he feared they would flee if released.

Niedermeier said he would rule on Terwilliger's request Wednesday, after the men obtain lawyers.

The three were arrested early Saturday in Richford, a small town on the Vermont-Canadian border, after police seized a nylon bag containing explosives that allegedly belonged to Kabbani.

Mourad and Younan had crossed the border Friday from Canada in a van, telling Border Patrol agents that they were on their way to Boston for the weekend, according to an FBI affidavit.

Electronic devices designed to detect people crossing the border near the Richford port of entry registered a signal indicating another person was trying to enter the country, the affidavit said.

According to the affidavit, Richford Police Chief Richard Jewett, patrolling about a mile from the border, noticed a man walking along a road near railroad tracks that cross the border, carrying a black nylon bag over his shoulder.

Jewett saw a van parked in a restricted area and went to ask its occcupants to move. He then approached the man who was walking and noticed that he no longer had the black nylon bag.

Jewett questioned the man, who identified himself as Kabbani and said he was returning to Canada after visiting in Burlington. Jewett took him into custody and later returned to search the area, where he found the black bag.

A Vermont state police explosives expert was called in and identified the contents of the bag as explosive devices.

The van was later spotted at a Richford motel, and the two men Jewett had questioned earler, Mourad and Younan, were arrested as they left the motel.

Terwilliger said it was ''too early to speculate on any possible motives for the activities.''

But word of the arrests comes in the wake of threats by Iran that Islamic fundamentalists would strike back at the United States for military actions in the Persian Gulf, including the shelling last week by U.S. warships of two Iranian military platforms.