A judgement found then-Health Secretary Matt Hancock did not uphold a public sector duty to promote equality when hiring officials in 2020.
The relevant appointments were of then-chair of NHS Improvement Dido Harding and former Sainsbury's CEO Mike Coupe.
In a statement, Mr Hancock said he had always acted quickly to "save lives".
The case was brought by race equality think tank the Runnymede Trust and legal campaign group The Good Law Project, although the court found the latter did not have standing to bring the claims.
In a statement, the department of health and social care said: "The judgement is clear that all claims raised by the Good Law Project were dismissed and the ruling itself stated their claim 'fails in its entirety'."
The department added that it had "used the skills and expertise of both the public and private sector to rapidly build a world-leading testing infrastructure" speed up testing and "ultimately saving more lives, especially amongst the most vulnerable".
Baroness Harding, a Conservative life peer, was appointed interim chief executive of the National Institute for Health Protection in August 2020, while Mr Coupe was made director of testing at NHS Test and Trace in September 2020.
Lord Justice Singh and Mr Justice Swift accepted the recruitment process followed in the appointments did not comply with one section of the Equality Act 2010.
The Act states a public body has a duty to "advance equality of opportunity between persons who share a relevant protected characteristic and persons who do not share it".
The protected characteristics cited in the case were disability and race.
Jason Coppel QC, who led the legal teams representing the plaintiffs, said the government had a "policy or practice" of "making appointments to posts critical to the pandemic response" without adopting sufficiently fair or open competitive processes.
Candidates "less likely to be known or connected to decision-makers" were put at a disadvantage, he said.
The court's ruling said the defendants in the case had failed to provide evidence of "exactly what was done to comply with the public sector equality duty when decisions were taken on how each appointment was to be made".
Two other claims - that the government had exhibited "indirect discrimination" and "apparent bias" in making the appointments - were dismissed.
"The judgment handed down today by the High Court is incredibly significant to the British people," said Dr Halima Begum, the Runnymede Trust's chief executive.
"It shows the importance of the public sector equality duty and its role in protecting the people of this nation from the closed shop of government appointments, not least in a time of national crisis where people from our minority communities were dying from Covid in hugely disproportionate numbers."
Responding to the ruling, a spokesperson for Mr Hancock highlighted the fact the claims of "apparent bias" and "indirect discrimination" had been thrown out and that the claims brought by the Good Law Project had "failed", adding "this group continues to waste the court's time".
"The court judgment also states that 'the evidence provides no support... at all' for the allegation that Dido Harding secured senior positions on the basis of 'personal or political connections' in the government." he said.
"They accept these 'were urgent recruitment processes which needed to find highly specialised, experienced and available candidates within a short space of time'.
"Let's not forget, we were dealing with an unprecedented global pandemic, where time was of the essence in order to protect and save lives."
Jo Maugham, director of the Good Law Project, said those in power should take the time "to find the best people - not the best-connected people - for the job".
Deputy Labour leader Angela Rayner said a public inquiry into the pandemic response should begin "right now" so it can "uncover exactly how this government made decisions in a national emergency".