I think diplomacy dictates that he should honour the visit. And, even though I am somewhat anti-Monarchist, I believe Charles is highly intelligent and well-schooled in the art of diplomacy and will subtly make it clear that he is there to commemorate the 250 years of American Independence.
I doubt Trump will appreciate that level of subtlety and could well see the visit as an endorsement of him and the launch of the "major combat operations in Iran", (to quote). However, as others have pointed out, Trump will not be the POTUS indefinitely - even if in his seemingly muddled mind he believes otherwise, and this visit is about our relationship with the USA, an ally we still need - at the moment. Until we have weaned ourselves off this 'special' relationship and dependency on it, we have to play the game. Unfortunately.
I'd imagine - but obviously don't know - Charles is not looking forward to this visit, or the bit that involves spending time in Washington DC anyway. And Trump's recent insult to our service men and women must stick in his craw, but the visit is not all about Trump.