* Police fire tear gas, stun grenades at Besigye party HQ
* Museveni, in power since 1986, in lead with 62 percent
* Opposition dispute early results, allege vote rigging (Adds detail, background)
By Edith Honan and Elias Biryabarema
KAMPALA, Feb 19 (Reuters) - Police detained Uganda's main opposition candidate Kizza Besigye for the third time this week and clashed with his supporters on Friday as early contested election results showed President Yoweri Museveni set to extend his 30-year grip on power.
Officers set off stun grenades and fired tear gas at crowds outside the headquarters of Besigye's Forum for Democratic Change (FDC), where senior members of the party accused organisers of rigging the vote.
Police later bundled Museveni's chief challenger into a van as the party was preparing to hold a press conference, a Reuters witness said. Officers said he was about to announce unofficial preliminary results - one commander said he had not been arrested but simply taken home.
Museveni, one of Africa's longest-serving leaders, has presided over strong economic growth, but faced mounting accusations at home and abroad of cracking down on dissent and failing to tackle corruption.
Other clashes broke out across the capital, and the spokesperson for another presidential contender, former prime minister Amama Mbabazi, said police had barricaded him in his home, stoking tensions a day after the vote. That report could not be confirmed independently.
Early results showed Museveni, a Western ally against security threats including Islamist militants, with a sizeable lead of 62 percent based on a count of ballots in 42 percent of polling stations. Besigye trailed with 33 percent of the vote, and Mbabazi with 2 percent.
But Dan Mugarura, a senior official from Besigye's party, said there were "glaring discrepancies" compared to reports from polling stations.
The Electoral Commission has regularly denied accusations of anti-opposition bias. "(Besigye) is a Ugandan but he is living on another planet. Let him respect Ugandan law," said commission chairman Badru Kiggundu on Friday.
The 71-year-old sitting president had earlier warned that anyone caught stoking violence would face the wrath of Ugandan security forces, who were deployed in heavy numbers across capital Kampala in riot gear.
Besigye, who challenged Museveni unsuccessfully in three previous elections, has repeatedly said the election would not be free and fair.
Late on Thursday, he was briefly detained in Kampala for alleged criminal trespass and assault. U.S. State Department spokesman John Kirby said it called into question Uganda's commitment to a transparent election, free from intimidation.
Election day was otherwise largely peaceful, although voting was delayed in some areas, especially in the capital. The government, citing security fears, said it shuttered the social media such as Facebook and Twitter, though all were working again on Friday.
On Friday morning, voting resumed in a handful of areas where delays in delivering polling materials had prevented some people from casting their ballot.
"It's our right to vote," said Geofrey Were, 32, as he stood waiting for the second day in a row in the Ggaba neighbourhood of Kampala. "This man has ruled us for 30 years. Obviously we need a change." (Additional reporting by Ben Makori and Goran Tomasevic; Writing by Drazen Jorgic; Editing by George Obulutsa and Andrew Heavens)