By reverse engineering Google Play Store app some projects has been created that support the unofficial protobuf based API that is also used by Google Play Store app itself. Using this API it is possible to retrieve meta data of an app not installed.
However as the API is designed for being used on a device you will get only get results "filtered" respectively adapted for that device: e.g. if an app is available in different variants for different types of devices (e.g. armv7/arm64 or one for older and one for newer Android versions) you will get only the data of the variant for your device.
See for example the following projects:
Note that Google permanently changes parts of this API, therefore older projects may not (fully) work. Also the supported protobuf data objects is different, depending on the focus of the project. But meta data calls for version code -/name should work on all projects once you managed to sign-in. Authentication got a bit problematic since about one year. Google is very restrictive which clients to accept to use the old authentication API.