What's the best over the counter medication and the safest for treating pinworm?

Ask the pharmacist. At your local drug store, pyrantel is the generic used in the USA OTC, but read the labels carefully, and more importantly is to be sure that it is pinworm infestation not something else, good luck.