By Dan Levine and Mica Rosenberg

(Reuters) - A Nevada judge on Tuesday rejected Republican presidential candidate Donald Trump's request for records from a Las Vegas polling place that the campaign said had allowed people to vote after a deadline last week.

Trump and Democrat Hillary Clinton are in a close contest for Nevada's six electoral votes in Tuesday's election after a long and contentious campaign. Nevada is one of several states that permits early voting and Las Vegas is viewed as a base of support for Clinton.

Nevada state law says voters who are in line at 8 p.m., when the polls close, must be allowed to cast their ballots. Trump's lawsuit, filed in a Nevada state court on Monday, said election officials violated state law because they allowed people to join the line after 8 p.m. at a polling location at a Latino market during last week's early voting period.

Trump a New York businessman and reality TV personality who has never previously run for political office, said last month that he might not accept the outcome of the national election if he thinks it is unfair.

"We have to keep the system honest," Trump said on Fox News on Tuesday before Eighth Judicial District Court Judge Gloria Sturman rejected his request.

The suit had asked the court to order officials to preserve various records from the Cardenas Market and to segregate ballots from the voting machines at issue.

At a court hearing in Las Vegas on Tuesday, a county attorney argued that election officials already preserve records. Sturman agreed, saying she did not want to issue an order that could help reveal which candidate were chosen by particular voters.

The Trump campaign also had asked for information about poll workers on duty at the market and Sturman said she was concerned they might face threats for helping people vote.

"Have you watched Twitter? Do you watch any cable news shows? People can get information and harass them," the judge said.

Clinton spokesman Glen Caplin said the campaign was pleased by the ruling and described Trump's suit as "a desperate response to the record turnout we’re seeing in Nevada and across the country."

(Reporting by Dan Levine in San Francisco and Mica Rosenberg and Nate Raymond in New York; Editing by Grant McCool and Bill Trott)