The Glasgow-based comedian said he thought it important to highlight the issue by mocking the attitudes of racists he "despised" in comedy routines.
Boyle was giving evidence on the second day of a trial in London after complaining that the Daily Mirror had libelled him by describing him as "Racist comedian Frankie Boyle" in an article.
He says he has "actively campaigned" against racism and claims the newspaper "misunderstood" the context of his use of language in jokes.
Daily Mirror publisher Mirror Group Newspapers (MGN) is defending its article, published on July 19, 2011.
MGN lawyers have described Mr Boyle as a "racist comedian" who gratuitously exploits negative stereotypes of black people for "cheap laughs".
Jurors were today shown footage from the BBC satirical show Mock The Week in which Mr Boyle and other comedians discussed immigration.
Mr Boyle said he was "pretending" to be someone with racist views during the episode.
He said he "despises" people with such views and thought it "important" to mock them.
"I don't think British people are racist," Mr Boyle told jurors yesterday.
"I think it is a top-down thing. I think you have a lot of rich and Conservative people who control our country who are racist and their views trickle down through things like tabloid papers."
He added: "I think there is racism at the heart of British policy and has been both in Labour and Conservative times."
Mr Boyle said he was shocked at being described as racist in the Daily Mirror article.
"It just went against everything I've tried to do in my life and against everything I've tried to do in my work," he said.
"There's a principle. Being called racist is not like being called vile. It's an extra serious thing, it's an extra serious claim.
"If I take this on the chin it sets a very serious precedent. I think the idea of taking racism down to this casual level is a very serious thing."
He said he thought most people think of him as "the most anti-racist comedian" in Britain.
Boyle's brand of humour has often proved controversial with audiences.
Last year, broadcasting watchdog Ofcom upheld more than 500 complaints about his Channel 4 show Tramadol nights, during which he joked about model Katie Price's disabled son, Harvey.
In 2008, the BBC had to apologise when Boyle made a joke about Palestine on the Radio 4 comedy show Political Animal.
A year after that, BBC 2's Mock The Week was criticised by the BBC Trust over comments Boyle made on the show about swimmer Rebecca Adlington's appearance.
The newspaper has defended itself "on the basis of truth and fair comment".
The hearing continues with the trial expected to last until the end of the week.