In Scrabble, how to determine the main word if the player has just played one single tile but formed two different words?
Main words are not a concept of the game of Scrabble itself, only of the written Scrabble notation commonly used to record tournament games (and likely also found in some computerised versions of the game), although it has since been incorporated into some rule sets that also outline the notation system.

Since the notation system is used simply to track moves, it doesn't matter which combination in your example would be chosen as the main word - both words still score the same within the game, and the notated move would still create the same two words on the board if the game were to be replayed.

As such it doesn't matter if the main word is selected randomly, always horizontal, always vertical, alphabetically, or otherwise.