As long as the washing machine is outside of zone 2 (0.6m away from the bath/sink/shower) you can do it the way you said.
BUT, it has to be supplied by a switched fused spur, not a socket, and protected by a 30mA RCD.
Unless you have a huge bathroom and can fit a socket 3m away from said bath/sink/showers.