You don't 'set' the #<_task> parameter, you use an 'if' statement in your code to check the value of the #<_task> parameter.
Examples:
In ngc code:
Code:
o100 if [#<_task> EQ 1]
;everything in here is only executed during actual gcode execution
o100 endif
In a python remap:
Code:
if self.task == 0: # ignore the preview interpreter
yield INTERP_EXECUTE_FINISH
return INTERP_OK