\documentclass{tufte-book}
\usepackage{alltt}
\begin{document}
\begin{alltt}
Some text that asdfasfd \sidenote{Side note}
\parindent0pt{}some more text
\end{alltt}
\end{document}
Note you need to be very careful with white space in such an environment. You have to use {} after \parindent0pt a space that would normally be OK would be typeset here.
Also \noindent (as used in the first draft) only works for one line, the next line would still be indented. (@egreg noted in chat)
One can patch \sidenote to behave properly in an alltt environment:
\documentclass{tufte-book}
\usepackage{alltt}
\makeatletter
\let\tufte@@sidenote\sidenote
\newcommand{\alltt@sidenote}[1]{\tufte@@sidenote{#1}\parindent=0pt}
\g@addto@macro\alltt{\let\sidenote\alltt@sidenote}
\makeatother
\begin{document}
\begin{alltt}
Some text that asdfasfd\sidenote{Side note} uuuu
some more text
and again text
\end{alltt}
\end{document}