Buckingham Palace banned "coloured immigrants or foreigners" from serving in office jobs in the 1960s, historical documents show.
Lord Tryon, Keeper of the Privy Purse at the time, made the revelation in papers unearthed from the National Archives.
The documents were discovered by the Guardian newspaper, which was investigating how civil servants negotiated with royal aides for an exemption for Queen Elizabeth II and the royal household from proposed race discrimination legislation.
T G Weiler, a Home Office civil servant, in February 1968 wrote a summary of a meeting with Lord Tryon.
He reported that employees at the royal household fell “into three categories (a) senior posts, which were not filled by advertising or by any overt system of appointment and which would presumably be accepted as outside the scope of the bill; (b) clerical and other office posts, to which it was not, in fact, the practice to appoint coloured immigrants or foreigners; and (c) ordinary domestic posts for which coloured applicants were freely considered, but which would in any event be covered by the proposed general exemption for domestic employment”.
Mr Weiler went on to say that royal aides were concerned that the proposed legislation “would for the first time make it legally possible to criticise the [royal] household”.
“Many people do so already, but this has to be accepted and is on a different footing from a statutory provision,” he wrote.
The legislation was eventually passed with an exemption that meant a tribunal dealt with allegations of racism in the royal household rather than the courts.
The exemption reportedly remains in place in the 2010 Equality Act.
A Buckingham Palace spokesman said the queen complied with anti-discrimination legislation “in principle and in practice”.
“Claims based on a second-hand account of conversations from over 50 years ago should not be used to draw or infer conclusions about modern-day events or operations,” he said.
Race became a major issue for the monarchy this year after the Duke and Duchess of Sussex accused an unnamed member of the royal family of asking, before their son was born, how dark Archie's skin would be.
Buckingham Palace said recollections of what transpired may vary, but that Harry and Meghan’s claims were taken "very seriously".
Prince William defended the monarchy, saying "we're very much not a racist family".