Trump's purpose of being in MT is/was to campaign for Senate candidate Tim Sheehy. (He previously did the same for 2018 Senate candidate Matt Rosendale, so him going there does not necessarily make his candidate a lock to win. On the flip side, national Democratic political figures going there to campaign for downballot Democrats would contribute to said downballot races becoming nationalized, which in the case of a deep red state like MT would be detrimental to said Democratic candidates' chances of winning.)
The thing I don't get is that Trump has uniquely little appeal in Bozeman compared to other Republicans and compared to other towns in Montana. If you're a Republican running statewide in Montana, Bozeman is the kind of place you need to over-perform national Republicans, even if the Democrat is able to run up numbers in places where Trump has shown more unique appeal, like Butte. So, if you're going to do a joint rally with Trump in Montana, why do it in Bozeman and not somewhere like Butte or Great Falls?