Take the cover off the hot tub and unzip it. Remove any wood, if applicable, and hang the vinyl inside-out to dry over a fence or clothesline.
Put on rubber gloves and fill a bucket with bleach. Scrub the vinyl thoroughly with bleach, using the scrub brush to kill algae, bacteria and mold that may be on the vinyl. Rinse the vinyl with the garden hose and let it air-dry.
Purchase new foam panels at a pool and spa supply store. You can typically purchase foam in 4-by-8-foot pieces.
Measure the old foam pieces and cut the new foam to size with a utility knife. Cover the foam in polyurethane wrap and tape it shut with silicone tape. Each of these is waterproof and will keep the foam from becoming waterlogged.
Turn the vinyl cover right-side out and put the wood back in, if so equipped. Stuff the new foam into the vinyl cover and zip the cover closed to finish repairing your hot tub cover.