You can theoretically obtain an infinite number of master balls in X and Y, but it'll require a lot of luck.

There is the one you get in the Pokeball factory

And there is the one you can win in the Loto-Id center in Lumiose City. However, this is extremely difficult and luck based, as it requires the ticket drawn having an exact match with a hidden value of one of your Pokemon, so don't count on it. It's quite the longshot