The government was warned against housing asylum seekers at a former Army barracks during a pandemic months before it was hit by an outbreak, the High Court has heard.
Public Health England (PHE) raised concerns with the Home Office in September over the dormitories at Napier Barracks in Folkestone, Kent.
"This advice was apparently not followed," Mr Justice Chamberlain said.
The Home Office said steps had been taken to ensure the camp was "safe".
More than 100 residents tested positive during an outbreak earlier this year, a remote preliminary hearing was told.
Mr Justice Chamberlain ruled claims by six asylum seekers that the barracks were inadequate should be considered in a judicial review.
Lawyers also argue the dormitory accommodation lacks privacy and adequate toilet facilities.
Tom Hickman QC, representing three asylum seekers, said many residents were vulnerable and had "mental health problems, which arise from the circumstances in which they left their country of origin and their journey to the UK".
The six asylum seekers bringing the case have since been rehoused, but 63 men remain at the site, which once housed 400 people, the court heard.
PHE told the Home Office "dormitories were not suitable" but that, if they must be used, there should be two metres between beds and six-people dormitories should be treated as "one bubble and kept together and away from others as much as possible," the judge said.
But he said the advice was not followed.
Lisa Giovanetti QC, for the home secretary, said PHE's outbreak control team would meet Home Office officials on Thursday to give advice on "how to safely manage the Covid outbreak at Napier going forwards".
"The secretary of state is doing everything in the meantime pending the hearing to make sure the accommodation is safe and adequate in the coming weeks," she added.
After the hearing, a spokesman for the Home Office said: "The government provides safe, warm and secure accommodation with three nutritious meals served a day, all paid for by the taxpayer.
"Napier has previously accommodated Army personnel and it is wrong to say it is not adequate for asylum seekers.
"The Home Office has worked extremely closely with Public Health England to minimise risks of coronavirus and this track record will be robustly defended in court.
"Today's initial hearing is one step in the legal process - the Home Office has not lost or conceded the case."
A two-day judicial review will begin on 13 April.