Put 8 cups water and 2 large pinches of salt into a medium pot and bring to a boil over high heat. Meanwhile, heat a large skillet over medium-high heat until hot but not smoking. Add chiles and toast, turning once, until pliable, about 30 seconds per side. Transfer chiles to pot of boiling water, add vinegar, and cook until soft, 15–20 minutes. Drain, reserving 2 cups of the cooking liquid. Transfer chiles to a blender, add garlic and reserved cooking liquid, and puree to a smooth paste. Season to taste with salt and set paste aside.
Set oven rack in lower third of oven, then preheat oven to 325°. Put ham into a large roasting pan. Make about 20 small incisions all over ham with the tip of a paring knife, then rub all over with margarine and cover with reserved paste. Roast in oven, basting every 30 minutes, until internal temperature in the thickest part reaches 160°, 5–6 hours. (The paste on the ham will get very dark and may burn slightly.)
Meanwhile, put potatoes into a large pot, cover with cold water, and add 2 large pinches of salt. Bring to a boil over medium-high heat and cook potatoes until soft, about 20 minutes. Drain, peel, and set aside. Add potatoes to roasting pan alongside ham about 1 hour before ham is finished roasting.
Transfer ham to a cutting board or platter, remove and discard twine, cover loosely with foil, and set aside to let rest for 20 minutes before carving. Serve with potatoes and pan juices.