I will be sitting the New York bar exam in a week and just sorted out my ESTA stuff online. I was wondering is my purpose for travelling covered under the Visa Waiver Programme. Do I need a different visa is my main worry?
If you qualify for a VWP/ESTA then visiting in order to conduct forms of business where you aren't being paid is normally permissible:
The Visa Waiver Program (VWP) allows citizens of participating countries* to travel to the United States without obtaining a visa, for stays of 90 days or less for tourism or business. ...
The following are examples of activities permitted while in the United States on the VWP. * consult with business associates * attend a scientific, educational, professional, or business convention or conference * attend short-term training (you may not be paid by any source in the United States with the exception of expenses incidental to your stay) *negotiate a contract (Source)
While test taking is not explicitly permitted, "training" and other forms of academic activity is -- as long as you are not being paid.
The problem is that the only reason you'd take the NYS bar -- in the eyes of an examiner -- would be to work in the future as a lawyer in the USA. So they may raise legitimate concerns about your intent to immigrate that you will have to dispel. See for example this internet post here where the poster was denied because of insufficient ties to his home country.
You may need to come up with a convincing reason why you'd want to take the NYS bar exam but then return to work as an attorney in your home country.