HP is more important but you need to make sure those HP specs are accurate. It's common practice for manufacturers to lie about HP ratings. (comparing running amps will tell a more accurate story)
You want to make sure the rpm's of your new motor are the same as the old. The pump is designed to run at a certain rpm. As Dave already mentioned a 50 rpm difference is nothing. As he also mentioned hp is just as or even more important. If that pump is designed for a 5 hp a 3 hp is going to bear down to get that pump going. That will cause the motor to wear out at a faster rate. It could even trip the breaker or overload protection when first starting. If the pump is suppose to run with a 5 hp I'd get a 5.
Post your question in the electrical section. I got some great help a few weeks back when I installed and wired my truck 5 hp motor and magnetic starter. Some very knowledgeable electric guys.
What does your motors spec plate say? Pick one close to the the same input voltage, amperage, and RPM as your compressor in the correct form factor and your done.
1800 RPM would be fine, BUT you would need to run a smaller 'drive' pulley on the motor in order for it to have enough torque to turn the pump, and then you need to be sure that the pump would then be running above the MINIMUM required RPM per the specs. So long answer short...maybe.