For Ditto, HP and Speed are most important. 252 HP/252 Speed/4 Defense or Sp. Defense. With Ditto, you'll probably be running Choice Scarf to ensure tat you are faster than the opponent. Being able to outspeed the opponent is probably one of the most important parts of using Ditto.
For Wobbuffet, you definitely want to put 252 in HP. To me, the goal of using wobbuffet is to make sure they do a lot of damage to you, so I'd actually consider putting the rest in Speed, so you can outspeed slow Pokemon and encore or destiny bond them. Wobbuffet has no use for Attack and Special Attack, and increasing the defensive stats mean that you do less damage back to them on the counter moves. I'd do something like 252 HP/252 Speed/4 Defense or Special Defense.