Lawyers for six men who had been housed at Napier Barracks in Folkestone, Kent, argue the accommodation breached their human rights.
Nearly 200 people contracted the virus during an outbreak at the camp.
Lisa Giovannetti QC, representing the Home Office, said clinically vulnerable people had been "sifted out".
She said that Home Secretary Priti Patel had "always accepted and acknowledged that transmission risk is higher in congregate settings of this sort".
However, the secretary of state had decided it could be used safely "by introducing the safeguards, including selecting the individuals that could be housed there with least risk," she said.
Ms Giovannetti told the court that advice from Public Health England, which had raised concerns about the use of dormitories during the pandemic, was "primarily about minimising risk of transmission".
"They are not assessing the degree of risk to any individual of significant illness," she added.
Ms Giovanetti said people who were likely to fall seriously ill had been "sifted out", with only "relatively young people in good health" being sent to Napier.
"Throughout the outbreak nobody did fall seriously ill or was hospitalised and none of the claimants became seriously ill or was hospitalised," she added.
Earlier, Tom Hickman QC, representing four of the claimants, said the camp was "squalid, ill-equipped, lacking in personal privacy and unsafe".
Residents were placed at "exceptionally high risk" of contracting Covid-19, while also being "exposed to conditions that had serious detrimental impacts on their mental health," he said.
All six claimants are said to be victims of human trafficking or torture.
Mr Hickman said that with high fences and a nightly curfew, it had "all the hallmarks of a detention facility" and was "not adequate accommodation for vulnerable persons".
The Home Office argues that it acted lawfully.
The hearing, before Mr Justice Linden, is due to conclude on Thursday, with a judgement expected to be handed down at a later date.