The order is based on the gold medals.
if you are curious about how many athletes are sent per country here's a link https://www.businessinsider.in/sports/news/ranked-every-nation-at-the-tokyo-olympics-by-the-number-of-athletes-they-have-taken-to-japan/slidelist/84690956.cms#slideid=84691184
I just want to add that the Philippines Finally got a Gold medal after being known as a country with the most medals without gold for a long time.
Japan now have the first place in terms of having most golds, they are 1 gold away from team US and China.
I agree that the possibilities of Japan to win either tops spot or the second one is very high, host country mostly have the most athletes
to compete in each sports, imagine that numbers of competitions that they've got the chance of winning a medals.