What accounts into calculating the Hubble constant?
I think this might answer your question, I have quoted the important paragraph below.


  If peculiar velocities could have any value, then this would make Hubble’s law useless.
  However, peculiar velocities are typically only about 300 km/sec, and they very rarely exceed
  1000 km/sec.
  Hubble’s law therefore becomes accurate for galaxies that are far away, when H0d is much larger
  than 1000 km/sec.
  Furthermore, we can often estimate what a galaxy’s peculiar velocity will be by looking at the
  nearby structures that will be pulling on it.


So it seems that in answer to your question, if the galaxy is far enough away then the peculiar motion can be neglected, or if its close by, a reasonable approximation found using estimates from nearby galaxies (in a cluster for example).