No, betta fish do not get lonely. Betta fish are inherently aggressive and territorial and, as a result, they are liable to fight with other bettas as well as other species.
While they may appear lonely in their tank, betta fish are naturally inclined to lead lives of solitude.
With that said, betta fish can get bored and even depressed, especially if they’re kept in a small tank. To prevent boredom, keep your betta fish in a 5-gallon tank or larger. Also, make sure to provide plants and hiding spots so your betta gets plenty of stimuli.