South Bend, Indiana Mayor Pete Buttigieg once won an essay contest through the JFK library. The topic? Bernie Sanders

Now, Buttigieg could run against Sanders in a bid for the White House.

When an 18-year-old Pete Buttigieg won an essay contest through the John F. Kennedy Presidential Library and Museum, he couldn't have known he might one day run against the subject of his entry: then Rep. Bernie Sanders.

"There’s no way I would have guessed that I’d be in this situation," Buttigieg said in a recent interview on the podcast, Pod Save America.

The John F. Kennedy Profile in Courage Essay Contest asks students across the nation to write an essay focusing on an elected official in the United States who courageously addressed a political issue. In 2000, Buttigieg’s essay won out of more than 600 essay submissions.

In his writing, Buttigieg praised Sanders as a "powerful force for conciliation and bi-partisanship on Capitol Hill."

"Here was somebody who really just said what he was for and he didn't seem to care as much about the politics of it," Buttigieg said on the podcast.

The 37-year-old mayor of South Bend, Indiana is exploring a 2020 presidential bid crowded with declared Democratic candidates, including the senator from Vermont.

"I absolutely would not have pictured then that I’d wind up potentially competing with him," Buttigieg told Pod Save America.