The attacking Ball Lightning would deal 3-6 damage to itself and the rest to the defending player.
Assigning combat damage and actually dealing combat damage are two different actions during the combat damage step:
510.1. First, the active player announces how each attacking creature assigns its combat damage [..]
510.2. Second, all combat damage that’s been assigned is dealt simultaneously [..]
Shield dancer's ability modifies how damage is dealt, but the rules for assigning combat damage from an attacking creature with trample remain the same:
702.19b The controller of an attacking creature with trample first assigns damage to the creature(s) blocking it. Once all those blocking creatures are assigned lethal damage, any remaining damage is assigned as its controller chooses among those blocking creatures and the player or planeswalker the creature is attacking. [..]
When determining what constitutes lethal damage, the Shield Dancer's ability is not taken into account. 702.19b continues:
702.19b [..] When checking for assigned lethal damage, take into account damage already marked on the creature and damage from other creatures that’s being assigned during the same combat damage step, but not any abilities or effects that might change the amount of damage that’s actually dealt. The attacking creature’s controller need not assign lethal damage to all those blocking creatures but in that case can’t assign any damage to the player or planeswalker it’s attacking.
Therefore, the attacking player has to assign at least 3 and at most all 6 points of damage to the Shield Dancer, so it would receive lethal damage. The rest is assigned to the defending player. Then when the damage is actually dealt, the Shield Dancer's replacement effect happens, the damage assigned to the Shield Dancer is dealt to the Ball Lightning instead, and the damage assigned to the defending player is dealt to that player.