Ms Gildernew won the Fermanagh-South Tyrone seat in June's general election by 53 votes.
At the High Court on Friday, the challenge by the defeated Ulster Unionist candidate James Cooper, who launched a petition to remove her, was rejected.
Mr Cooper, an Enniskillen solicitor, had alleged that "threats and actions" by Sinn Fein members led to votes being cast after closing time in a polling station at Garrison in County Fermanagh.
During a two-day hearing in the High Court in Belfast last month, two polling clerks said there had been voting after the 2200 BST closing time.
One of them said 15 or 16 votes were cast, while the other estimated the number at between 15 and 20.
Mr Cooper said in his petition that if the invalid votes wrongly included in the count were disallowed, he would have a majority.
However, on Friday, Lord Chief Justice Sir Robert Carswell, who heard the case with Lord Justice McCollum, rejected this analysis.
Delivering the court's verdict he said: "We do not consider that the number of voting papers issued in that time could be materially more than 30, and that number falls well short of the successful candidate's majority of 53 votes.
"We therefore hold that the breaches of the regulations did not affect the result of the election."
Action was 'vindicated'
Speaking outside the court, Mr Cooper said his lawyers would study the judgment before deciding whether to appeal.
He said he was extremely disappointed but believed "the court entirely vindicated our decision to take this case".
"I believe the decision of the court not to make a costs order in this case amply reflects the view that this type of abuse can't be tolerated in a modern democracy."
However, Ms Gildernew said the judgment had shown that her party had not abused the electoral system.
"If there had have been any evidence of intimidation we wouldn't have won the case," she said.
"There was no evidence of reprehensible behaviour."