Play video content EXCLUSIVE TMZSports.com

Mayor Pete Buttigieg is going to bat for Colin Kaepernick ... telling TMZ Sports he supports the QB's right to take a knee during the national anthem -- and he's ripping Trump for going after the protesters.

"The way I feel about it is the flag that was on my shoulder when I served represented, among other things, our right to free speech," Mayor Pete -- a Navy veteran -- told us in New York.

Play video content 9/22/17 FOX News

"You don't have to like it, but one of the reasons we serve was to defend that right, the right of peaceful protest and the idea that we can protest what is wrong with our country."

That's when Pete took a swipe at POTUS -- who has publicly called for the NFL to fire any "son of a bitch" who doesn't stand for the anthem.

"If the president had served," Pete says ... "Maybe he'd feel a little more strongly about some of those freedoms. And, I get that there's a lot of strong opinions about this, but that's part of why we served."

Colin began his demonstration in 2016 to shine a light on social injustice and police brutality. Several players joined his movement, which began a very polarizing political topic.