There are now calls for stronger interventions in classrooms amid warnings that most pupils who experience racist abuse "suffer in silence”.
A Freedom of Information request by the Liberal Democrats has found 2,251 instances of racism in schools between the 2017/18 and 2019/20 academic years.
Glasgow City Council saw the highest number of reported incidents with 642, with reports in Edinburgh at 490.
Orkney recorded the lowest level of incidents with three, all of which occurred in 2017/18.
Lib Dem education spokeswoman Beatrice Wishart said: “No one should go to school afraid that they will face racist abuse, but these figures show that racist incidents remain a stubborn stain on Scottish schooling.
“All forms of bullying need to be challenged effectively. That means accurate recording and monitoring of bullying so that the right interventions can be put in place to stamp these incidents out.
“The Black Lives Matter movement has encouraged us all to think about racial injustice and to reflect on Scotland’s own history."
The Show Racism the Red Card Scotland charity called for greater support for teachers to help identify the problem in classrooms.
“The number of racist incidents recorded in our schools is staggering yet only exposes the tip of the iceberg as generally racism is heavily underreported,” said campaign manager Jordan Allison.
"Over the last three years, our charity has found that 32 per cent of the young people we worked with have experienced or witnessed racism in Scotland’s classrooms and playgrounds.
"We welcome the Scottish Government’s commitment to educating children on tolerance and respect. However, these latest figures bring into focus the thousands more who continue to suffer in silence every day, and call for greater support for our teachers to recognise, challenge and report racism effectively.”
Ministers insist that any form of bullying is "entirely unacceptable”.
"We need to be vigilant in challenging any racist and abusive behaviour in schools," a spokesman for the Scottish Government said.
"Where it occurs, it must be challenged through educating children about all faiths and belief systems, ensuring they learn tolerance, respect and equality.”
The Scottish Government has funded Respectme, the National Anti-Bullying Service, and the Coalition for Racial Equality and Rights to produce a resource for schools that provides guidance on effectively challenging racism in schools.
Schools in Scotland are run by local councils and a spokeswoman for their umbrella body Cosla said new ways of recording incidents to expose the problem had been developed.
“We are clear that there is no place for racism within our schools and we are committed to tackling racist bullying," the spokeswoman said.
“In 2019 we implemented a national approach to recording and monitoring incidents of bullying in Scottish schools, which was developed with the Scottish Government and trade unions.
“In recent months we held initial discussion with the Scottish Government on how race is addressed within schools across a range of areas including the curriculum, bullying and the diversity within the workforce and will continue these considerations in the months ahead.”