Yes you can operate your electric dryer or gas dryer during a thunderstorm.
There's no need to unplug your dryer during a thunderstorm as I've left my electric dryer plugged in during thunderstorms for years and so did my parents.
I always have laundry to do especially with kids and always run the dryer and washing machine whether there's a storm outside or not.
Never has it been an issue nor has my dryer suffered any damage as a result of using it during a thunderstorm and neither did my washing machine.
Many people also use their washer and dryer machines during thunderstorms without an issue.