What you should do
As Prevarications’s fine answer points out, reincarnate specifically notes that miracle or wish can undo it. A single casting of miracle is worth 1,530 gp, which is a reasonable quest reward even at quite low levels—the tricky part will be finding a 17th-level cleric capable of providing that reward, though of course a DM could simply decide that Moradin or whoever just provides the miracle of their own accord when the quest is complete.
As From’s fine answer notes, Player’s Handbook II has “rebuilding” rules, including for race—which explicitly notes that it can be a solution to reincarnate. This has you going on a side-quest; the book has a few examples, but ultimately it’s just a usual adventure for characters of your level.
And, as I originally thought was the only thing you could go with, Savage Species defines several “major rituals” to change what type of creature you are on pages 149 to 151. The Ritual of Vitality is probably the cheapest, at 1,000 gp and 1,000 XP. But of the three, it’s the most expensive, and Savage Species is a much more obscure and troublesome source than either of the PHBs.
Problems with polymorph
Ultimately, polymorph isn’t a great answer, for several reasons:
The first thing to note is that, on some level, polymorph doesn’t make you a dwarf—it makes you (physically) a half-elf polymorphed into a dwarf. That doesn’t change just because you make it permanent—and note that permanent magic is still vulnerable to dispelling.
Second, you didn’t mention how you were going to make polymorph permanent, which is a question because I don’t know of any way to do it. The permanency spell only applies to a few, select, specified spells—and polymorph isn’t one of them. The far-more-powerful 8th-level spell polymorph any object can be permanent as part of its native properties—and probably would be, for a half-elf to dwarf. So that could be an option, but it would be considerably more difficult to acquire.
Third, polymorph (or polymorph any object) doesn’t just give you everything of what you’re turning into, and in the particular case of the dwarf, it’s very confusing what it actually gives you.
The subject gains the Strength, Dexterity, and Constitution scores of the new form but retains its own Intelligence, Wisdom, and Charisma scores.
This arguably means you get the dwarf’s +2 to Constitution, but that is far from clear. Strictly as written, you probably instead get the Str 13, Dex 11, Con 14 of the example dwarf monster, which may or may not be to your benefit.
It also gains all extraordinary special attacks possessed by the form
OK, again looking at the dwarf monster description, we see:
Special Attacks: Dwarf traits
Which is great news for you: this is all the things that a dwarf usually gets, including the Constitution bonus (and Charisma penalty), the movement speed and ability to ignore medium or heavy armor, darkvision, stonecunning, weapon familiarity, stability, skill and saving throw bonuses, etc. For some reason, those are all listed as special attacks, and they’re all extraordinary, so you get all of them.
but does not gain the extraordinary special qualities possessed by the new form or any supernatural or spell-like abilities.
The supernatural or spell-like abilities aren’t a concern; the dwarf doesn’t have any. But the extraordinary special qualities are a problem, because, again going back to the example dwarf statblock, we have
Special Qualities: Darkvision 60 ft., dwarf traits
You may recognize these as the things that were also listed as special attacks, which polymorph said we did get (you might also note that 60-ft. darkvision was already part of the dwarf traits). So now we’re in a situation where polymorph says “you get dwarf traits, but do not get dwarf traits.” Ask your DM. (Notably, polymorph any object doesn’t fix this problem. Shapechange does, but now that’s a 9th-level spell, and in any event it isn’t permanent and I can’t think of a way to make it so.)
Fourth, there is absolutely nothing in the rules about how these things interact with requirements. Suppose you think you want to be a dwarven defender—you’d be wrong about that, but for the sake of argument—and you need to meet the “Race Dwarf,” requirement. Does a half-elf polymorphed into a dwarf count? For that matter, does a dwarf reincarnated as a half-elf? No one knows! All we have is “Race Dwarf.” Nothing in the rules anywhere expands on precisely what this means. Again, you’ll have to ask your DM. If your DM wants to know what the official rule is, you’ll have to tell them that there isn’t one, and they have to just make something up.
Were it me, I’d allow a dwarf-reincarnated-as-a-half-elf to just take any dwarf-specific feats or prestige classes, even in their half-elf body, unless something about it was really specific to the actual physical properties of the dwarven body.¹ But that ruling would extend only as far as my table—for your table, you have to ask your DM.
For the sake of argument, I just checked, and at least in my opinion, there are just two dwarf-specific options that I wouldn’t let a dwarf reincarnated as a half-elf take. Those two are the Azerblood feat from Races of Faerûn, and the silver key from Dragonmarked—and the silver key is only a problem if you’re actually playing in Eberron. The Azerblood feat depends on the actual genetic heritage of Azers flowing through a shield dwarf’s veins—reincarnating as a half-elf would mean you don’t have azer blood anymore. The silver key is all about improving House Kundarak’s dragonmark, the Mark of Warding, and it’s very important to the Eberron campaign setting that the dragonmarks are limited to their respective families. Outside of Eberron, though, you can ignore that.
There are 9 other prestige classes with a dwarf requirement:
1, the knight protector of the great kingdom, actually requires “Race: Dwarf, elf, half-elf, human,” so you still meet that requirement no matter what.
5 of them—battlesmith, deepstone sentinel, deepwarden, ironsoul forgemaster, and runesmith—have an official Adaptation section suggesting the racial requirement can be dropped (the runesmith suggests making the other requirements tougher if you do, though I don’t see any good reason why you should). So clearly there’s no real reason one has to be a dwarf for these, and Wizards of the Coast outright tells us so. (Ironsoul forgemaster and runesmith are also the only dwarf-specific prestige classes that are actually good, though a dip in deepwarden sentinel for Con-to-AC is interesting.)
3 remaining classes are dwarven defender, hammer of Moradin, and stonelord. The dwarven defender is just a fighting style—and a really poor one, but still one a half-elf could learn. The hammer of Moradin is culturally very dwarven, but a half-elf body would be no impediment to anything it does. And the stonelord is just earth-and-stone magic, which anyone could do.
For the feats, there’s 41 of them total, so I won’t list them all, but I’ve scanned the list and Azerblood was the only one that stands out. The rest are all about things you know (training, cultural background, etc.) and still would, or about spiritual connections to your people, the ground, or dwarven gods, which you would also still have.