Pauley dismissed a lawsuit brought by the American Civil Liberties Union, which promised to appeal to the 2nd U.S. Circuit Court of Appeals in Manhattan.
"We're obviously very disappointed," said Brett Max Kaufman, an attorney with the ACLU's National Security Project. "This mass call tracking program constitutes a serious threat to Americans' privacy and we think Judge Pauley is wrong in concluding otherwise."
Justice Department spokesman Peter Carr said: "We are pleased the court found the NSA's bulk telephony metadata collection program to be lawful."
NSA spokeswoman Vanee Vines declined to comment.
In arguments before Pauley last month, an ACLU lawyer argued that the government's interpretation of its authority under the Patriot Act was so broad that it could justify the mass collection of financial, health and even library records of innocent Americans without their knowledge, including whether they had used a telephone sex hotline, contemplated suicide, been addicted to gambling or drugs or supported political causes. A government lawyer had countered that counterterrorism investigators wouldn't find most personal information useful.
Pauley said there were safeguards in place, including the fact the NSA cannot query the phone database it collects without legal justification and is limited in how much it can learn. He also noted "the government repudiates any notion that it conducts the type of data mining the ACLU warns about in its parade of horribles."
The ACLU sued earlier this year after former NSA analyst Edward Snowden leaked details of the secret programs that critics say violate privacy rights. The NSA-run programs pick up millions of telephone and Internet records that are routed through American networks each day.
Pauley said the fact that the ACLU would never have learned about an order authorizing collection of telephony metadata related to its telephone numbers but for Snowden's disclosures added "another level of absurdity in this case."
"It cannot possibly be that lawbreaking conduct by a government contractor that reveals state secrets — including the means and methods of intelligence gathering — could frustrate Congress's intent. To hold otherwise would spawn mischief," he wrote.
Pauley also rejected the ACLU's argument that the phone data collection program is too broad and contains too much irrelevant information.
"That argument has no traction here. Because without all the data points, the government cannot be certain it connected the pertinent ones," he said. "Here, there is no way for the government to know which particle of telephony metadata will lead to useful counterterrorism information. When that is the case, courts routinely authorize large-scale collections of information, even if most of it will not directly bear on the investigation."
Associated Press writers Mark Sherman and Kimberly Dozier in Washington contributed to this report.