What you will need to do is file a non resident tax return with the state of Maine to claim a refund of the taxes which were withheld in error.
On the return that you file you will be asked to enter the total of your Maine source income and the total of ME taxes withheld. You will simply enter zero as the total of your Maine income, and then show the tax amount which was withheld, and you should receive a refund check for those taxes.
If this was helpful please press the Accept button. Positive feedback is also appreciated.
Thank you cap