I had an exact situation a few years ago. A horse trainer built a barn with an indoor arena and a 2 apartments. One for her when she was on the "farm" and the other for the full time care taker. Based on the square footage of the stalls and arena section vs the apartments we did not classify it as a dwelling.
_________________________
The opinions expressed are mine and they are not to be taken as legal advice.