Consider any two dipoles of dipole moments p1 and p2 placed parallel to each other along a straight line. Let the distance between them be d, and the length of the dipoles be 2l1 and 2l2.
Net force on the second dipole due to the first is the sum of force experienced by the positive and negative charges of the second dipole due to the electric field of the first dipole.
F = F+ + F- = (1/4)[2p1q2/(d+l1)3 + 2p1(-q2)/(d-l1)3]ep2 where ep2 is the unit vector along p2.
F =-(1/4)(2p1q2)[6d2l2 + 2l23/(d2-l12)3]ep2 If the distance between the two dipoles d, is much greater than the dimensions of the dipoles, then d2>>l12 F =-(1/4)(6p1p2/d4) ep2 The force is directed away from the dipole moment direction. Hence its an attractive force.