To every Poisson algebraic variety X over an algebraically closed field of characteristic zero, we canonically attach a right D-module M(X) on X. If X is affine, solutions of M(X) in the space of algebraic distributions on X are Poisson traces on X, i.e., distributions invariant under Hamiltonian flows. When X has finitely many symplectic leaves, we prove that M(X) is holonomic. Thus, when X is affine and has finitely many symplectic leaves, the space of Poisson traces on X is finite-dimensional. As an application, we deduce that noncommutative filtered algebras whose associated graded algebras are coordinate rings of Poisson varieties with finitely many symplectic leaves have finitely many irreducible finite-dimensional representations. The appendix, by Ivan Losev, strengthens this to show that in such algebras, there are finitely many prime ideals, and they are all primitive. More generally, to any morphism phi: X -> Y and any quasicoherent sheaf of Poisson modules N on X, we attach a right D-module M_phi(X, N) on X, and prove that it is holonomic if X has finitely many symplectic leaves, phi is finite, and N is coherent. As an application, the finiteness result for irreducible representations of noncommutative filtered algebras extends to the case where the associated graded algebra is not necessarily commutative, but is finitely generated as a module over its center, which is the coordinate ring of a Poisson variety with finitely many symplectic leaves. We also describe explicitly (in the settings of affine varieties and compact smooth manifolds) the space of Poisson traces on X when X=V/G, where V is symplectic and G is a finite group acting faithfully on V. In particular, we show that this space is finite-dimensional.