how to make a clock like this?
How about using a decade counter like (74HC)4017? You use a single clock signal for input and you connect the first unused output to \$\overline{\text{RESET}}\$



So in your case you would connect "Decoded output 4" to \$\overline{\text{RESET}}\$ and use "Decoded output 0, 1 and 2" as output. The clock input must be four times higher than the desired output.