You can't tell Trac to use unique ticket numbers between projects, but you can change the way you write ticket numbers so that Trac knows which one you're referring to.
Trac has a type of link called an InterTrac Link that references a resource in a specific Trac project (even on another server). You configure an InterTrac link by adding a section like this to your trac.ini file:
[intertrac]
s = sample
sample.title = Some Trac project on the server
sample.url = http://sample.yourserver.com
Now, you can refer to resources in that specific Trac project by doing things like:
sample:ticket:502
s:ticket:502
s:#502
#S502
All of the above would link to ticket #502 in the Trac project called "sample". You can use this sort of syntax to reference any resource in the target Trac project (see the Trac documentation listed above for details and more examples). If all of your Trac projects use the same InterTrac link settings, then they can all use a single syntax to uniquely address resources across projects.