An extension of the coulomb $P^3M$ algorithm to include dipole-dipole interactions in an efficient manner is presented. Theoretical estimates for the root-mean square error of forces , torques and energy are derived. The applicability of the estimates is tested and confirmed in several numerical examples. A comparison of the computer performance of the new algorithm with state-of-the-art dipolar-Ewald methods shows a performance cross-over from dipolar-Ewald to dipolar-$P^3M$ method for a number of particles as low as $N \sim 300$. In larger systems, the new algorithm represents a substantial improvement in performance with respect to the fastest dipolar-Ewald methods.