On the face of it, you need:
 debug_msg[0] = (NUC >> 24) & 0xFF;
 debug_msg[1] = (NUC >> 16) & 0xFF;
 debug_msg[2] = (NUC >>  8) & 0xFF;
 debug_msg[3] = (NUC >>  0) & 0xFF;
(where the >> 0 is optional but makes it look neater — if the compiler optimizes to omit any shift for that).  If you want to handle different values in place of NUC, then:
unsigned long value = 0xA8051701;
debug_msg[0] = (value >> 24) & 0xFF;
debug_msg[1] = (value >> 16) & 0xFF;
debug_msg[2] = (value >>  8) & 0xFF;
debug_msg[3] = (value >>  0) & 0xFF;
Or in macro form:
#define MANGLE(value, debug_msg) \
    debug_msg[0] = (value >> 24) & 0xFF; \
    debug_msg[1] = (value >> 16) & 0xFF; \
    debug_msg[2] = (value >>  8) & 0xFF; \
    debug_msg[3] = (value >>  0) & 0xFF
used as:
MANGLE(0xA8051701, debug_msg)
or, if you want the values at arbitrary offsets in the array:
#define MANGLE(value, debug_msg, offset) \
    debug_msg[offset+0] = (value >> 24) & 0xFF; \
    debug_msg[offset+1] = (value >> 16) & 0xFF; \
    debug_msg[offset+2] = (value >>  8) & 0xFF; \
    debug_msg[offset+3] = (value >>  0) & 0xFF
Used as:
MANGLE(0xA8051701, debug_msg, 24);
There might be a need to wrap the body of the macro in a do { … } while (0) loop to make it work properly after an if statement, etc.
Or you could write an inline function to do the job. Or …