High Court judge Anthea Pang rejected Lai's latest application last week but only made public the reasons for her decision on Tuesday.
The case is being closely watched as it shows how Hong Kong's independent judiciary resolves any conflicts between the security law drafted in Beijing - where courts come under the Communist Party - and the city's common law traditions.
The new law puts the onus on the defendant to prove they would not be a national security threat if released on bail. Under Hong Kong's common law-based legal system, the onus has traditionally been on the prosecution to prove its case.
"If one was determined, the foreseeable danger of being discovered might not be a bar to action," Pang's written judgement said.
"I am not satisfied that there are sufficient grounds for believing that the Applicant will not continue to commit acts endangering national security if bail is granted to him."
Lai was arrested in August on suspicion of collusion with foreign forces when about 200 police officers raided the newsroom of his Apple Daily tabloid newspaper. He was arrested again last week, while in jail, on suspicion of assisting a fugitive China captured at sea last year.
Beijing imposed the national security law on the former British colony last June after months of pro-democracy protests. The law punishes anything China considers subversion, secession, terrorism or collusion with foreign forces with up to life in prison.
Critics say it is aimed at crushing dissent and it erodes freedoms in the semi-autonomous financial hub. Its supporters say it restores stability after months of unrest.
Prosecutors have accused Lai of breaching the law over statements he made on July 30 and Aug. 18, in which they allege he requested foreign interference in Hong Kong's affairs.
Lai has been a frequent visitor to Washington, meeting with officials, including former Secretary of State Mike Pompeo, to rally support for Hong Kong democracy, prompting Beijing to label him a "traitor".
(Reporting by Jessie Pang; Writing by Marius Zaharia, Editing by Angus MacSwan)