When Dickie was created Earl of Mountbatten, it was quite likely that he would have no more children. Being close to his daughters, he asked that a provision be inserted into the Letters Patent allowing Patricia and Pamela to succeed to the Earldom should he have no male heirs. When he was assassinated, the Earldom went to Patricia as she was the older of the two and had no brothers. This doesn't apply to any female who is not a daughter of Lord Mountbatten, though, so no other females (barring the death of Patricia and all her descendants before the death of Pamela) will inherit the Earldom.
All of this must be done upon the creation of the title, however. This cannot be done for the Duke of York, as his title was created upon his marriage with no such remainder. Theoretically, he could be granted a second Dukedom of York with a special remainder. He would then become the 1st Duke of York of the 8th creation and the 1st Duke of York of the 9th creation. This was done in 1900 for the Duke of Fife, who had been created Duke of Fife previously in 1889. Thus, for the 12 years until his death, he was 2 Dukes of Fife at once. If this was done for Andrew, the 8th creation of the Dukedom of York would go extinct on his death, while Beatrice would become the 2nd Duchess of York of the 9th creation.