This question is addressed in Sefer Zera Shimshon - Bamidbar...It can be found translated and elucidated in Artscroll's newly released Sefer on page 541... and on https://zstorah.com/
direct link to the pdf...
Bilaam was upright as the spirit of prophesy rested upon him and is referenced as four commoners who have no share of the world to come implying he might have had a share in the world to come from being on that list.
Paying heed to Rashi's own words:
Bilaam says in Numbers 24:13
"'If Balak gives me his house full of silver and gold, I cannot transgress the word of the Lord to do either good or evil on my own; only what the Lord speaks can I speak.'"
in contrast to
"Balaam answered and said to Balak's servants, "Even if Balak gives me a house full of silver and gold, I cannot do anything small or great that would transgress the word of the Lord, my God."
'My God' is absent from Numbers 24:13 as said in Numbers 22:18 because Bilaam himself knew he had lost his upright status.
In the beginning until Numbers 22:35 Bilaam was fit and from this the Merciful One had mercy on him and killed the donkey.