Once again we should remember that we are receiving this tale long after the fact, and as part of Ammon's recounting to Alma. We don't get all of Ammon's thought processes here, only his conclusion. Ammon had to have had some indication from the Spirit that he would be able to use this event to position himself with king Lamoni, for the situation would not obviously present itself as advantageous. There is nothing about Ammon to suggest that he was so assured of his physical prowess that he would invite a fight. There was some indication through the spirit that this would be an advantageous course of action.