We propose to synthesize arbitrary nonclassical motional states in optomechanical systems by using sideband excitations and photon blockade. We first demonstrate that the Hamiltonian of the optomechanical systems can be reduced, in the strong single-photon optomechanical coupling regime when the photon blockade occurs, to one describing the interaction between a driven two-level trapped ion and the vibrating modes, and then show a method to generate target states by using a series of classical pulses with desired frequencies, phases, and durations. We further analyze the effect of the photon leakage, due to small anharmonicity, on the fidelity of the expected motional state, and study environment induced decoherence. Moreover, we also discuss the experimental feasibility and provide operational parameters using the possible experimental data.