How to test if argument is a single space?

You are not iterating using macro arguments, so you do not need to test a macro argument, just test the token you have already:

enter image description here

\documentclass[11pt,a4paper,english,twoside,notitlepage]{book}

\usepackage{fontspec}
\usepackage{lmodern}
\usepackage[english,main=english]{babel}
\usepackage{xcolor}
\usepackage{etoolbox}


\definecolor{purple}{HTML}{2B0057}
\definecolor{candy}{HTML}{FF0000}

\newcounter{alternate} 

%the macro in question
\newcommand{\colset}[1]{%
    \ifnum\value{alternate}=0 {\color{candy}{#1}\setcounter{alternate}{1}}%
    \else{\color{purple}{#1}\setcounter{alternate}{0}}%
    \fi}

\makeatletter
%snippet for the loop taken from https://tex.stackexchange.com/questions/359189/looping-over-strings
%iterates over the supplied string and replaces every letter with \colset{<letter>}
\def\gobblechar{\let\xchar= }
\def\assignthencheck{\afterassignment\xloop\gobblechar}
\def\xloop{%
    \ifx\relax\xchar
    \let\next=\relax
    \else
    \ifx\@sptoken\xchar\setcounter{alternate}{\numexpr1-\value{alternate}}\fi
    \colset{\xchar}\let\next=\assignthencheck
    \fi
    \next}
\makeatother
\def\markletters#1{\setcounter{alternate}{0}\assignthencheck#1\relax}

\begin{document}
\markletters{Hello World}
\end{document}

You can substitute spaces with something that expands to a space.

\documentclass[11pt,a4paper,english,twoside,notitlepage]{book}

\usepackage{fontspec}
\usepackage{lmodern}
\usepackage[english,main=english]{babel}
\usepackage{xcolor}

\definecolor{purple}{HTML}{2B0057}
\definecolor{candy}{HTML}{FF0000}

\ExplSyntaxOn
\NewDocumentCommand{\markletters}{m}
 {
  \int_zero:N \l_tmpa_int
  \tl_set:Nn \l_tmpa_tl { #1 }
  % replace spaces with something different
  \tl_replace_all:Nnn \l_tmpa_tl { ~ } { \c_space_tl }
  \tl_map_inline:Nn \l_tmpa_tl
   {
    \tl_if_blank:eTF { ##1 }
     { ~ } % don't advance the counter and issue a space
     {
      \textcolor{ \int_if_odd:nTF { \l_tmpa_int } { purple } { candy } } { ##1 }
      \int_incr:N \l_tmpa_int
     }
   }
 }
\prg_generate_conditional_variant:Nnn \tl_if_blank:n { e } { T,F,TF,p }
\ExplSyntaxOff

\begin{document}

\markletters{Hello World}

\end{document}

enter image description here