With AppleScript how can you check if spctl is enabled?
I think what you're looking for could be:

try
    do shell script "spctl --status"
on error E
    E
end try


Returns assessments enabled or assessments disabled accordingly.


System info: AppleScript version: 2.7  System version: 10.13.6