I'm really sorry this is happening to your son, it's very frustrating to navigate these sort of social dynamics.
My youngest has gone through similar, a few times throughout preschool and kindergarten, and from that experience I can say that this won't be the last time this happens; kids just change over time, and have different things they want out of relationships, just like adults.
Kindergarten is a major change for everyone, and it's very common to have total shakeups of social dynamics at this point. It doesn't mean, though, that this child is no longer a friend; this is a major change in everyone's life, and it's very possible they're simply exploring other friendships, but will come back to your son over time. They also may not - it's possible they did change in some way that makes them less interested in your son's friendship.
With my youngest, I found a few things helped. Not minimizing his feelings was key, as these were major, important feelings; he'd be very sad that his former best friend was no longer playing with him, and we'd talk about how it makes him feel. In those conversations, we'd give him tools: how does he talk to his friend? How does he talk to other kids he might want to play with? We'd also go over strategies: how does he identify another group of kids to play with? What can he do if he doesn't have anyone to play with right now?
Another major thing to consider is that it's very important to learn that one can carry on if a friendship ends. Some kids like to have a large stable of friends to play with, and some don't - they like to attach to one other kid and play with just them. For kids in the latter group, it's important to be able to learn how to move on from a friendship - both learning to accept that it's not something that makes them a bad person, and learning what to do; making new friends, finding things to do when there isn't a friend available.
With my youngest, we worked on being able to do things on our own at recess, at how to ask a group of kids if it's okay to join, and at how to talk to the (former) friend later on and see if they're now ready to play again. I can't say any of this truly solved the issue, because the hurt is always there - but it helped him move on. He's still mostly a "one friend" kid, but now he knows that he can continue on if that friend leaves - and he does play with others from time to time, showing us that he has learned how to navigate the complex social dynamics of the (now third grade) playground.
One other thing to consider as a parent is to let the teacher know what's going on. I don't suggest asking the teacher to do anything, because this really is something the kids need to learn for themselves - nothing's worse than being the kid adults have to tell other kids to play with - but the teacher should be aware so they can monitor for more serious issues, and so they can let you know how things are going socially. Some teachers are more willing and able to do this than others, but a kindergarten teacher should be willing to help here - it's a very important element of kindergarten, honestly more important than the textbook learning.