U.S. District Court Judge Matthew Brann wrote that he would not "disenfranchise almost seven million voters," as the Trump campaign had sought.
"One might expect that when seeking such a startling outcome, a plaintiff would come formidably armed with compelling legal arguments and factual proof of rampant corruption," Brann wrote. "That has not happened."
The judge, a Barack Obama appointee, dismissed the case with prejudice, meaning the Trump campaign cannot resubmit the case. The defeat levels a blow to the most high-profile case brought by the president in his multi-state effort to challenge the results of the Nov. 3 election.
The crux of the Trump campaign lawsuit was that its poll watchers were not able to observe the counting of mail-in ballots, creating opportunities for "Democratic counties" to accept fraudulent and technically deficient ballots and "diluting" the power of voters in other counties.
The case in Pennsylvania was argued Tuesday in court by Trump's personal attorney, former New York City Mayor Rudy Giuliani.
The Trump campaign's legal team vowed to appeal the district court ruling, if possible, to the U.S. Supreme Court.
"Today's decision turns out to help us in our strategy to get expeditiously to the U.S. Supreme Court," the statement from Trump lawyers Giuliani and Jenna Ellis said. "Although we fully disagree with this opinion, we're thankful to the Obama-appointed judge for making this anticipated decision quickly, rather than simply trying to run out the clock."
Though Brann was an Obama appointee, he spent years as a Republican Party official, including as chairman of the Bradford County Republican Committee.
But the decision led Pennsylvania Republican Sen. Pat Toomey to congratulate President-elect Joe Biden, despite adding he was "deeply disappointed" Trump lost.
"With today's decision by Judge Matthew Brann, a longtime conservative Republican whom I know to be a fair and unbiased jurist, to dismiss the Trump campaign's lawsuit, President Trump has exhausted all plausible legal options to challenge the result of the presidential race in Pennsylvania," Toomey said in a statement. "I congratulate President-elect Biden and Vice President-elect Kamala Harris on their victory. They are both dedicated public servants and I will be praying for them and for our country."
"Another judgement on behalf of the voters of Pennsylvania," said state Attorney General Josh Shapiro, a Democrat, in a statement. "These claims were meritless from the start and for an audience of one. The will of the people will prevail. These baseless lawsuits need to end."
The Biden campaign, which received over 80,000 more votes than Trump in the state, said in a statement from campaign spokesman Michael Gwin, "Yet another court has rejected Trump and Giuliani's baseless claims of voter fraud and their appalling assault on our democracy. The judge's ruling couldn't be clearer: our people, laws, and institutions demand more -- and our country will not tolerate Trump's attempt to reverse the results of an election that he decisively lost."
In a 37-page opinion, Brann wrote that the Trump campaign and its co-plaintiffs, two voters who were not allowed to cure their ballots, "ask the Court to violate the rights of over 6.8 million Americans," then contends that "Granting Plaintiffs' requested relief would necessarily require invalidating the ballots of every person who voted in Pennsylvania."
"Because this Court has no authority to take away the right to vote of even a single person, let alone millions of citizens, it cannot grant [the Trump campaign's] requested relief," the opinion stated.
At one point in the opinion, Brann compares the Trump campaign's case to "a Frankenstein's Monster," saying the claims are "haphazardly stitched together" and attempt to "mix-and-match claims to bypass contrary precedent." That's a reference to a recent federal court decision that already invalidated many of the campaign's arguments.
Brann also took issue with the Trump legal team's disarray -- in which a revolving door of attorneys filed multiple amended complaints. The decision came as the Trump campaign had asked days earlier to file another amended complaint -- but the opinion means that effort will not be accepted.
ABC News' Will Steakin and Johnny Verhovek contributed to this report.