Just to answer the question as it is written:
The sharpest lens below $400 according to lenstip is: DA 50 F1.8 @F5.6
(Lenses available to compare were: DA 35 F2.4, DA 70 F2.4, FA 35 F2, FA 43 F1.8, FA 50 F1.4. There were a few more but those were definitely over $400.)
The sharpest lens below $400 according to photozone is (Earlvontapia said): Sigma 30 F1.4 @ F4
(Lenses available to compare were (sharpest to least): FA 35 F2, FA 50 F1.4, DFA 100 F2.8 Macro, DA 40 F2.8 Ltd, Sigma 24 F2.8, DA 70 F2.4 Ltd)
Now, extrapolating from the above data, the DA 50 F1.8 showed quite a bit more sharpness than the DA 35 F2.4. The DA 35 F2.4 is practically the same as the FA 35 F2. The Sigma 30 F1.4 is only a little sharper than the DA 35 F2.4. So I would conclude (however flawed this method is) that the DA 50 F1.8 is the sharpest lens you can get for Pentax below $400. Admittedly, a FA 50 F1.7 will be about the same as the DA 50 F1.8.
Now to throw another thing into the mix, the Sigma 50 F1.4 is sharper than the Sigma 30 F1.4 (also better across the frame, but most things are compared to the Sigma 30). Many users say that the Sigma 50 F1.4 is sharper than the FA 50 F1.7, which could put it above the DA 50 F1.8 - AND you can get it for $400 on black Friday!
Hope that helped! Or not really! But it was fun to write