"The lawsuit alleges that, from at least September 2018 to May 2022, SpaceX routinely discouraged asylees [those granted asylum] and refugees from applying and refused to hire or consider them, because of their citizenship status, in violation of the Immigration and Nationality Act," the Justice Department said in a statement.
In job postings and public statements over several years, SpaceX wrongly claimed that under federal regulations known as export control laws, SpaceX could hire only US citizens and lawful permanent residents, sometimes referred to as "green card holders", the Justice Department said.
The Justice Department also pointed to online posts from Mr Musk as examples of "discriminatory public statements".
The lawsuit cited a June 2020 post on X, formerly called Twitter, by Mr Musk that said: "US law requires at least a green card to be hired at SpaceX, as rockets are advanced weapons technology".
Mr Musk described the Justice Department lawsuit against SpaceX as "weaponisation of the DOJ for political purposes".
In a post on X, the SpaceX chief executive said the company "was told repeatedly that hiring anyone who was not a permanent resident of the United States would violate international arms-trafficking law, which would be a criminal offence".
First integrated flight test of SpaceX's Starship - in pictures
US Assistant Attorney General Kristen Clarke of the Justice Department’s civil rights division said a DOJ investigation found that SpaceX "failed to fairly consider or hire asylees and refugees because of their citizenship status and imposed what amounted to a ban on their hire regardless of their qualification, in violation of federal law".
Ms Clarke also said SpaceX recruiters and high-level officials "actively discouraged" asylum recipients and refugees from seeking work opportunities at the company.
The United States seeks fair consideration and back pay for asylum recipients and refugees who were deterred or denied employment at SpaceX due to the alleged discrimination, the Justice Department said.
The lawsuit also seeks civil penalties in an amount to be determined by a court, and policy changes to ensure that SpaceX complies with the federal non-discrimination mandate in future.