Create new v12.13.0 bench:
bench init --frappe-branch v12.13.0 frappe-bench
install ERPNext with following command:
bench get-app erpnext --branch v12.16.2
Check this for v10 How to manually install ERPNext v10.1.14 on Ubuntu 18.04
Another option is to use tagged version of docker images.