Before triggering the fight against Ganon, it is possible to keep your sword on the B button.
The most common way to keep the Master Sword is to superslide into the cutscene trigger, and hold up your shield until Ganon "hits" your sword away and Navi starts talking to you.
Right before you hit the cutscene trigger hit a button for a spell (I know it works with Din's fire) and after the cutscene, you should still have your sword.
When Ganon knocks the Master Sword out of Link's hand, the game removes the Master Sword from your inventory by flipping the bit, rather than zeroing it. Because of this, it's actually possible to obtain the Master Sword, rather than lose it (though it will still be removed from the B button if not prevented).
When you trigger the Ganon fight, Link will always have the Master Sword knocked out of his hands, which spawns a Master Sword actor. Touching this actor will give you back the Master Sword, and automatically equip it to B allowing you to beat Ganon as a Child.
Ganon's weak point is his tail. While the tail can be damaged by any weapon, the Master Sword/Deku Stick deal the most damage per hit, while all other attacks will only deal 1 damage. Stunning Ganon by shooting Light Arrows in his face does not deal damage. The final blow can only be dealt by swinging the Master Sword, so it's a good thing you'll always get one during this fight.
The optimal strategy is to simply walk between Ganon's legs to reach the tail, rather than stun him.
If you have both Deku Sticks and the Deku Shield, you should start the fight by performing a single Jump Attack to store a strong sword attack, then crouch stab into ISG by Z-Targetting Ganon and talking to Navi. To save a little time, the Jump Attack should be done into the trigger for the fight. With ISG active the Deku Stick will no longer break and you can simply walk between Ganon's legs to reach the tail.
After a few hits, Ganon will drop and the fire barrier will temporarily lower. Obtaining the Master Sword will disable ISG, so you will have to re-activate it to continue using the Deku Stick.
If you have the Kokiri Sword and fail to keep it on B, simply pause to re-equip it.