Competition is a good motivator. At the same time the feeling of continuously "losing" is not, so rankings should be used carefully as part of a wider pedagogical approach.
competition matters when there is something scarce to win. but if we apply that to education we already have a problem, because education should not be scarce. hence competition is not the right way to decide who should get access to it.
it also will hurt them in the long run at work. while in many companies employees do compete, these kind of workplaces are always toxic and not a good place to work at.
in a good workplace people cooperate, and that is something they need to learn in school.