Alphabet Inc.'s Google and DeepMind Technologies were sued last year by Royal Free patient Andrew Prismall on behalf of 1.6 million people for alleged misuse of private information.
The Royal Free London NHS Trust transferred patient data to Google's artificial intelligence firm DeepMind in 2015 in relation to the development of a mobile app designed to analyze medical records and detect acute kidney injuries.
Judge Heather Williams ruled on Friday that the case should not proceed, agreeing the case is "bound to fail".
"I conclude that each member of the claimant class does not have a realistic prospect of establishing a reasonable expectation of privacy in respect of their relevant medical records," she said in a written ruling.
The ruling came after Britain's data protection watchdog, the Information Commissioner's Office, said in 2017 that the Royal Free, which is part of the public National Health Service (NHS), misused patient data when it provided the information to DeepMind.
Alphabet argued in March that the case is "bound to fail" as there was no prospect of establishing that all 1.6 million claimants' private information was misused, or that they had any expectation of privacy in relation to the information.