The ruling from Judge William Pauley of the southern district court in New York came 10 days after a US federal judge in Washington deemed the NSA surveillance probably unconstitutional.
"The question for this court is whether the government's bulk telephony metadata program is lawful. This court finds it is," said the 54-page ruling.
The decision comes after the American Civil Liberties Union challenged the legality of the surveillance program. The judge threw out the petition.
"The bulk telephony metadata collection program represents the government's counter-punch: connecting fragmented and fleeting communications to reconstruct and eliminate Al-Qaeda's terror network.