The trumpet-shaped work, called Dirty Corner, has been vandalised three times since it was installed in June.
Sir Anish had said he would not remove the graffiti in order to highlight intolerance in society.
But a tribunal in Versailles ruled over the weekend that the graffiti must be erased and an alarm installed.
After that, the artist chose to gild the slogans into obscurity - calling it his "royal response" to the vandalism.
Dirty Corner, which has been dubbed the "Queens Vagina" in French media, was splattered with yellow paint shortly after its installation in June.
That was hastily cleaned off but, the following month, it was daubed with graffiti, some of it anti-Semitic, on two separate occasions.
After the tribunal ruling Sir Anish posted a picture of the sculpture on Instagram of the graffiti covered up by black sheets.
Next to the image, he said: "The racists in France have won a court judgement forcing the racist graffiti to be covered, blaming the artist and Versailles for inseminating racist propaganda.
"It is as if a woman is raped and blamed for her own rape. We will fight this. The racists cannot win. Join us!"
Speaking after ruling, Sir Anish told Le Figaro: "This decision breaks my heart."
He said he could not remove the graffiti because that would deny the fact that it had happened.
He said covering the sculpture in gold would ensure the slogans remained, transforming his original vision into "something else, a room still with a painful past, but a piece that first claims the beauty of art".
Speaking to The Art Newspaper, Sir Anish added that the gilding would be "an act of transformation which turns the nastiness into something else.
"I want something active, not reactive," he said.
The artist has recently distanced himself from earlier comments comparing the sculpture to "the vagina of the queen who took power", saying the work was open to interpretation.

Media playback is not supported on this device
Houghton, 27, has played a pivotal role in Hull's success in 2016 as Lee Radford's side chase a domestic treble.
He has made 1,130 tackles in 2016, more than any other player in Super League.
"I've tasted success winning the Challenge Cup and I want to do that over and over again," Houghton told the club website.
A controversial sculpture by Sir Anish Kapoor in the Versailles Palace gardens has been covered in gold leaf to mask anti-Semitic graffiti.
[NEXT_CONCEPT]
Hull FC hooker and vice-captain Danny Houghton has signed a new deal with the Challenge Cup winners and will stay with the club until 2020.