The best animal companion build that don't gimp your character I could come up with is:
Druid 7/Sorcerer 1/Beastmaster 1/Arcane Hierophant 10/Druid +1
Use Heighten Spell and Versatile Spellcaster for early entry.
Effective Druid Level of 22, Effective Sorcerer level of 11. Your Animal Companion will have 11 Intelligence. Anything above 3 will allow you to talk to it, and so don't need tricks or Handle Animal checks.
Train it in Warbeast (MM2) for an extra HD and +3 Str/Con, +2 Wis.
Alternatively, if you really want the AC to shine, use this:
Halfling (Strongheart from Faerun)
Ranger 4/Cleric 1/Prestige Paladin 3/Beastmaster 2/Halfling Outrider 10
1 - Mounted Combat, SF Handle Animal(b)
3 - Mounted Archery
6 - Devoted Hunter
9 - Dragonsteed
Animal companion - 12 (ranger) + 15 (beastmaster) = 27
Paladin Mount - 16 (prestige paladin)
Devoted Hunter allows you to add them together into one uber mount. Dragonsteed turns your mount into a Dragon. 16th Paladin level nets you a Very Young Gold Dragon as a mount.
The halfling might be a bit redundant, though.