Bad idea IMO. I think even using something like carbon bags, you would get particulates and it would be a muddy mess. Also, the only dirt you'd want to use would be mineralized topsoil, as MGOPS would leach ammonia and tannins. Still, I think it would be quite messy and not worth the trouble.
On the other hand, I once used a stocking full of Osmocote pellets (whichever kind is safe/ideal for planted tanks, I forget) in the HOB filter of a ten gallon. That worked out well, and every few months, I dumped out the empty shells and replaced them with fresh Osmocote. The plants really enjoyed that. If you want a long-term fertilizer in your sump, you could do that.