It looks like you got your code from This Macscripter question, and the code is already in that script. You just need to set the page range
of InDesign's PDF Export Preferences
tell PDF export preferences
set page range to "1, 3-5"
end tell
Just make sure to set it back at the end, because this is a persistent application setting.
tell PDF export preferences
set page range to all pages
end tell