I think that "was the program compiled with TSan" is a weird question, because you can have a program that only has some parts/sources/modules/libraries built with the instrumentation, and some that are not. So instead I usually ask the question "is the process running with the TSan runtime", which can be answered in many ways, for example with dlsym("__tsan_read8"), i.e. looking up a well-known exported function. Other option is to iterate over loaded modules and look for "libclang_rt.tsan...".
But note that the TSan runtime can be present even if you don't have a single instrumented file: The interceptors can sometimes catch problems even without any instrumentation.
Kuba