To turn it on, type this in Terminal:
sudo touch /private/var/db/.AccessibilityAPIEnabled
To then disable it, type this:
sudo rm /private/var/db/.AccessibilityAPIEnabled
Thats it. If you wanted to AppleScript it, you could do something like this:
do shell script ¬
"touch /private/var/db/.AccessibilityAPIEnabled" password "pwd" ¬
with administrator privileges
[robg adds: Somewhat obviously, replace pwd with your admin user's password. Also, change touch to rm for the opposite version of the AppleScript.]

