Yes I made the same mistake early last year with a Wise payment. I made a first payment to HMRC including the NI reference number then a few weeks later did a repeat transaction in Wise and accidentally validated it before entering the reference number.
I called HMRC and explained and they said it wouldn't be a problem and that they'd trace the right account to credit the payment to based on my name and the fact that they'd already had payments from me. I also wrote to them with the details. It took a long time but the amount was eventually credited to my NI contributions.
I'd advise you to call them, they were very helpful. I got the impression that I wasn't the first one to make this mistake!