I'm assuming you're flying Emirates if you're going via Dubai. If you book online, it might give you an option of a longer stopover; if you're booking through a travel agent, ask them to book the stopover. Essentially, you'll be on two different tickets (it's basically a multi-destination ticket) since the stopover is longer than a day.
When I flew from NY back to Jhb via London, I did a 7 day stopover so I had to collect my luggage when I arrived in London. However, when I flew from Canada to Jhb via London, my stopover was only 13 hours so my luggage was automatically transferred to the next flight even though I spent the day in London City with a friend. My flights were on Virgin Atlantic and I could specify my stopover online. I'm not sure if Emirates offers the same thing though.
If your stopover is less than a day, you can ask for your luggage to be tagged to the final destination when you initially check in. It's a good idea to check that it is done even if they don't ask because you don't want to get home and discover your luggage is still sitting in the airport of your transfer country ;)