How to preprocess an ordered categorical variable to feed a machine learning algorithm?
One way to do is to use target encoding:

https://medium.com/analytics-vidhya/target-encoding-vs-one-hot-encoding-with-simple-examples-276a7e7b3e64
https://towardsdatascience.com/target-encoding-and-bayesian-target-encoding-5c6a6c58ae8c

(There are a million resources to learn target encoding)
This way your categories will not only be ordered by the number but for the target value (what is at the end what you want, to give better predictions)