You will have to indicate NC down in "Other state income" on the Personal Info page.
Then, when everything has been entirely finished in the Federal section (every scrap of data),
1) you will go thru the NC non-resident state interview, and there is a page to indicate that the W-2 was NOT NC Source income. And on the pages that follow you need to put all zeros in for all the NC Nonresident income allocations. That should get all the NC withholding refunded to you.
2) Then you go thru the MD resident interview. You cannot take a credit for taxes paid to NC, because you are getting all the NC withholding refunded to you.
See if you can get a letter from that employer stating their withholding error, NCDOR may have some questions about it and may hold your NC refund until you answer them.
____________*Answers are correct to the best of my knowledge when posted, but should not be considered to be legal or official tax advice.*