As a Scottish person, I can say you are not racist if you wear that hat.
It is so far removed from what Scotland is actually like-especially now- that is isn't mocking anything real about Scottish identity.
Completely different, for example, to wearing traditional Muslim clothing or something, where oppressed and marginalised people DO actually wear those clothes now every day and are discriminated against for it.