Games should be fun. This DM is making it not-fun for you. Quitting was the right thing to do!
As for the "sore loser" comment, either one of two things may be happening:
For whatever reason, they were deliberately tormenting you. Calling you a "sore loser" is an attempt to manipulate you back into their control, so they can keep tormenting you.
They were making it hard on you unconsciously, and you quitting confronted them with the possibility that they were DMing badly. Since we humans, psychologically speaking, tend to conflate being bad at something with being a bad person, and we're indisposed to think badly of ourselves, we tend to try to explain problems by blaming other people first. So instead of admitting to himself that he's DMing badly, he decides that the problem must be with you and that lets him keep feeling like a good DM and a good person.
There is no difference between the first and the second in terms of your enjoyment of the game, so quitting is still the right thing to do regardless of which is the case.
The difference between the two is much more important at the group social level and the friendship level.
Because you don't know whether it was malicious, or whether it was a mistake that he's just having trouble owning, you are better off giving him the benefit of the doubt when you bring this up later. If you assume malicious intent, you'll do damage to your friendship if was an honest mistake; but if you assume good faith, you can't do any damage to your friendship that he hasn't already done himself by acting maliciously.
How you approach him is probably something you know best, since you know him better than we can, but starting by assuming good faith is the most important part. If it was an honest mistake, he's more likely to admit it one-on-one than in front of everyone else. (There is a powerful new-GM urge to appear infallible, which ironically makes the new GM more likely to screw up more and worse because they can't admit when they've made a mistake in order to fix it.)
One suggestion is to talk to him on a non-game day, ideally in person, and explain that you felt singled-out for punishment and you don't enjoy the game like that, so you won't be playing. The goal here isn't to make them admit their mistake, but to draw your own boundary where you don't play in games you don't enjoy and won't agree to anything else. In the meantime, this will also give them a chance to admit their mistake, but that's secondary to enforcing your own good boundaries.
Here's a sample script that might help you:
"I felt singled out during the game. What do you think was going on there?"
Let them talk here. Keep quiet, just listening, and let them say any ridiculous thing they want to say here, until they run out of things to say. They will probably defend, deny, and put the blame on you. Just let them keep talking until they're done. Assuming they don't admit their mistake and don't begin a conversation about how to fix it:
"Okay. Regardless of the reasons, I didn't enjoy playing and I think it's best if I just sit out this campaign."
Let them talk. They probably won't agree, but they don't have to agree with you because you don't need their permission to do something else on game days. Listen quietly until they run out of things to say again.
"I'm sorry you feel that way, but I'm going to do [this other activity you enjoy] on those days, so I won't be playing in this campaign."
(An "activity you enjoy" doesn't have to be big and complicated and obviously exclude playing in their game. It can be something that you could easily do some other time, like "catch up on some reading", "go to the gym more", "nap", "watch movies", or "play videogames". The point is not that this activity prevents you from playing in their game and can't be done elsewhen, the point is that you are the boss of your leisure time and you choose do this other thing instead. You're not saying you "can't" play because of a scheduling conflict [which they may try to fix!], you're saying you "won't" play because you want to do something you enjoy.)
And then end the conversation. Leave, stop answering the next email, close the chat window, whatever firmly disconnects you from them immediately. They probably won't be happy, but you're not responsible for their feelings and with a script like this you haven't said anything that is disrespectful, mean, or otherwise a cause of their unhappiness. Their unhappiness will be entirely because they're not getting what they want / confusing having an unhappy player with being a bad person / otherwise causing their own unhappiness in a way you can't fix for them.
What happens after you walk away is up to them. If they keep pestering you? Just say "Thanks for the invitation! But remember, I'm busy those days." If they change the game day, "Thanks for the invitation! But I'm not available to play in this campaign then either." Always a polite, but firm no, so long as they are insisting that you are the the who needs to do something different.
If they come to you and say they're willing to talk, and do actually admit the possibility that you were honestly not having fun and want to talk about how to fix that, then great! Have that conversation. If it goes south, "Okay, I still think I won't enjoy this game and I should just sit it out," then end the conversation before it becomes an argument. If the conversation goes well though, then I have no advice: hopefully, you won't need any!