Collecting rent on a granny flat at your primary place of residence can be treated like a regular investment property. This theoretically makes it possible to negatively gear a granny flat. With that said, check state laws. It is currently only permissible to rent out a granny flat in NSW, WA, NT, the ACT, and Tasmania.
However, due to the lower build cost of a granny flat, it’s more likely to be positively geared - that is, the income outweighs the cost. This is because much of a property’s value is tied up in land, which you’ve already purchased.
Also consider, too, that a common tax deductible item for negative gearing purposes is mortgage interest. If you’re on an owner occupier mortgage and need to use equity to build the granny flat for investment purposes, you will need to talk to your lender. It’s also highly advisable you speak to a financial adviser or tax expert.