We report the results of a search for T and CP violation in B0-anti-B0 mixing using an inclusive dilepton sample collected by the BaBar experiment at the PEP-II B Factory. The asymmetry between (l+,l+) and (l-,l-) events allows us to compare the probabilities P(anti-B0 -> B0) and P(B0 -> anti-B0) oscillations and thus probe T and CP invariance. Using a sample of 23 million B-anti-B pairs, we measure a same-sign dilepton asymmetry of A_(T/CP)=(0.5 +- 1.2(stat) +- 1.4(syst))%. For the modulus of the ratio of complex mixing parameters p and q, we obtain |q/p| = 0.998 +- 0.006(stat) +- 0.007(syst).