A few years ago a (black) rap artist was stopped at the side of the
road by police and they basically admitted that this was racial
profiling.

The artist made some fuss about it on social media, and it appeared
in all news broadcasts and talk shows. People were expecting some
big commotion about it; but it turns out that the majority of people
actually approved of this method.

It wasn't racism at work here, it was statistics and people were
fine with it.

Your conclusion is incorrect. Yes it is racism, and furthermore, the majority of people in a society being fine with it is not only irrelevant as to whether it's racism, it is what makes it structural racism. Something that everyone is fine with never seems questionable to members of the set of people who think it's fine.

Now let's explain why it being statistics doesn't mean it can't be racism. I have used this analogy before:

http://braythwayt.com/2016/03/30/racism-is-injustice.html

A woman is murdered in her home. Statistics tell us that when a woman is murdered in her home, it is nearly always her partner. So, why don't we merely arrest the partner and march them off to jail without gathering evidence, following pesky rules about having a lawyer involved, or examining the burden of proof?

Statistics, one might say, reverse the burden of proof. Why isn't it up to the partner to prove that they're innocent?

We can A/B test this application of statistics: Let's say that 9/10 times, the partner did it. In test A, we lock 100 partners up without trial. Presto, we have the right person in prison 90 times, and have an innocent person in prison 10 times, but being right 90% of the time feels pretty good, and we saved a lot of money and bother. Everybody who isn't the partner of a murdered woman feels pretty good about test A.

In test B, we arrest 100 partners, but then we gather evidence and have trials, even though "everybody knows the partner did it." Good news! Of the ten partners in test B who didn't do it, nine are set free. One, alas, is wrongfully imprisoned for a crime the did not commit. But one wrongfully imprisoned person is better than ten, right?

Well, it's not so simple. Of the 90 people who did do it in test B, the evidence wasn't always solid. So in ten cases, they cut a deal for a reduced sentence. In six cases, they "beat the rap in court" and were also set free, despite having done it. Three cases didn't even make it to court for some technicality or other.

So test B is much better for the case where someone is innocent: There is only one person wrongfully imprisoned, instead of ten. But it's worse for the case where someone is guilty. Instead of ninety guilty people receiving the full punishment, Only 71 receive the full punishment. Then get a reduced punishment, and nine guilty people walk free!

In pure, bloodless statistics, A is better than B. A is right 90% of the time, B is only right 80% of the time. But if we want to talk about justice, B is better than A. In terms of justice, one person wrongfully imprisoned is worse than 100 guilty people set free. False positives are abhorrent to a just society, and false negatives (not to mention costly trials) are the price society is willing to pay to ensure justice.

So back to statistics and stopping cars. If statistics tell you that black men are more likely to be illegal immigrants, or have unpaid fines, or whatever, and you use that to stop every black man driving a car, but you don't stop white men, that is unjust for the same reason as locking up the partners without trial.

You have imposed a consequence--not being able to drive without being stopped by police--on some number of innocent black men--because they belong to a class of people who statistically are more likely to have done something wrong.

One can argue that being stopped is not the same thing as being jailed without trial. But it is. When travelling, you might be asked if you have ever been detained by police. Same when applying for a job. In some countries (cough, USA, cough) this perspective on statistics starts with stopping cars, and ends in gunfire.

Even in civilised countries, people reason that if it's ok for the police to stop every black man because black men have statistically committed more crimes, it is ok to not rent to black men, or not employ black men. And if asked, they will say, "I'm not a racist, I'm a statistician.". Law enforcement choices send a strong message about "what everyone thinks is ok."

At some point, though, it comes down to justice. Justice is not imposing consequences upon someone without actual, inspectable evidence. Injustice is imposing consequences upon someone because somebody else who has something in common with them broke the law.

And racism is using statistics to impose injustice on someone because of their race. It's that simple.