This works on my High Sierra's arrangement:
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
tell application "System Events"
set wasRunning to count (processes whose name is "System Preferences")
end tell
tell application "System Preferences"
reveal anchor "keyboardTab" of pane "com.apple.preference.keyboard"
delay 1
end tell
tell application "System Events" to tell process "System Preferences"
click checkbox 1 of tab group 1 of window 1
end tell
if wasRunning = 0 then
quit application "System Preferences"
end if