How do I add a user and group with a specific ID
Found the answer that works from in a 4 year old post on this board.
This creates the user, and the group, with the specific gid.

dscl . -create /Users/vmail UniqueID 5000 PrimaryGroupID 5000 RealName "vmail"


It can be checked, because it runs silently, with the following. The command in my case gives the following output. 

bash-3.2# dscl . -read /Users/vmail UniqueID
UniqueID: 5000 PrimaryGroupID 5000 RealName vmail
bash-3.2# 


Ok, for some reason it doesn't actually add a the group - so you have to go into the GUI, System->preferences->Users/Groups and add the group, and set it's UID at the top, to 5000 - then it all works