Trump had one contested primary, and that was 2016. He took everyone by surprise there, so nobody was ready for him. The assumption at the time was that he would burn out after the novelty wore off. It didn't, and by the time they all realized it, he had too much momentum to be stopped.
Desantis knows Trump's style and knows exactly what he'll be facing. I think he's going to try. Remember, even if he loses, he can come back and try again -- either because Trump wins a 2nd term and can't run again, or because Trump gets too old to run again (or dies).
The more I think about it, the more it makes absolute sense for Desantis to run in 2024. If he wins the primary, he will be facing either the unpopular/senile Biden or some terrible replacement candidate on the D side. If he waits it out, he could have a much tougher D opponent, or some other Republican star could rise and pass him in popularity. It is fairly clear right now that Republicans don't really have much competition to present for Desantis in the primary, aside from Trump.