In a small bowl, whisk together the tamarind paste, fish sauce, lime juice, and chopped palm sugar. Work the mixture vigorously to break down the sugar — it won't dissolve completely yet, but most pieces should start softening. Fold in the minced shallots and chili flakes.
Heat a dry skillet over medium-high heat and add the raw rice. Keep it moving constantly with a wooden spoon or spatula — you want deep golden brown grains that smell nutty and toasted, which takes about 3-4 minutes. Don't let them burn.
Let the toasted rice cool completely, then grind it in a mortar and pestle or clean coffee grinder until you have a fine, flour-like powder. A few slightly coarser bits are fine, but avoid large chunks.
Give the sauce another vigorous stir to dissolve any remaining sugar crystals — press stubborn pieces against the bowl with the back of your spoon to help them along. Fold in the toasted rice powder and fresh herbs just before serving. The sauce should be glossy and thick enough to cling to whatever you're dipping.