The best thing you can do for bottles is to immediately rinse them with soap and water following a ride. No matter how exhausted you might be, take a few minutes to put a little soap and hot water in your bottles, give them a shake, then squeeze soap and water through the valve, and finally rinse thoroughly. Those few minutes will save you lots of hassle later and make sure nothing starts growing in your bottles. After that initial rinse then you can think about a more thorough cleaning.
The first thing to keep track of is what your particular bottle can tolerate. A dishwasher can be an excellent way to get a bottle clean but the high heat can also destroy a bottle, so check to see what yours can handle. Along the same lines, some bottles can handle a good scrubbing while others only need a rinse.
When it comes to mountain bike bottles you will likely need to spend some time on the exterior as well. Just using your hands and water might be enough to get the dirt off but if not be careful about getting too aggressive. A plastic bristle brush is a good option and some, gentle, non-scratch scour pads can work as well.
After you've got everything clean make sure to also let them dry completely. You'll have to remove the top and leave it off while they are drying or it's unlikely they will fully dry before the next ride. The exposure to air and a thorough drying will do a lot to make sure your bottles are clean and fresh the next time you grab them.