Cheapest way to get drying agent: buy a large container of crystal cat litter. At 8 lbs. for $10 it's way cheaper than little packets or the small jars for flower drying, and the unscented will do the job very well. If you don't mind the scented, it could help mask any remaining mold odor.
I've had moldy yarn because of a roof leak and because I had some in my old car and the window was partly open during a rainstorm. If you hang it out in the sun and air, most of the smell will leave. If it's actually moldy (like, you can see mold on it or it makes you sneeze) do wash it before you use it, and if it's not delicate yarn you might consider soaking it in white vinegar and then washing it. Vinegar will kill most mold without removing color, and the smell will go away when you air-dry it.