This requires two things: 1) a macro for creating a new directory and evaluating subexpressions in the context of that directory, and 2) a facility for enabling and disabling the automatic deletion of temporary directories.
Another nice property of this pattern is that if I want to test my test, i.e., to inspect the files it's creating, I can temporarily disable the automatic deletion of the sandbox directory by wrapping the whole thing in a(define keep-new-directories? (make-parameter #f))
[(_ dir-e e1 e2 ...)
(let ([dir dir-e])
(let ([result (parameterize ([current-directory dir]
e1 e2 ...)])
(parameterize ([keep-new-directories? #t]) ...).
Meta-conclusion: dynamic scope is useful.