If you're putting the loaches in the 20g with the betta.......no. The loaches grow too large for the tank.
If you're keeping them together in a tank large enough for the loaches when they're adults (i.e. 100g)..........no. The loaches eat small fish when they're adults.
If you're just growing out baby loaches in a smaller tank.....yeah, it's fine. I'm growing out 3 juvie clowns and I put my new white betta in there and they're fine.