The noun phrase the hobbyist community applies to both things: asking questions and sharing knowledge.
But the problem is that you ask questions of the community and you share your knowledge with the community. There's also the problem that you more naturally ask questions about trains and share your knowledge of trains.
Because each of these things result in a different formation, it's very awkward to have a single sentence where both parts make use of a common set of prepositions.
This can only really be avoided by not relying on a common set of prepositions. In doing this, the noun phrase also needs to be brought to the start of the sentence:
The hobbyist community where you ask questions about and share unique knowledge of trains.
But even though this is better (it now makes sense), and it retains all of the information in the original sentence, it's still a little lengthy and difficult to parse.
Since sharing can imply both questions and answers, it could be combined into just that single thing, making the assumption that knowledge sharing means asking and answering questions.
As before, the noun phrase could be at the start of the sentence:
The hobbyist community where unique knowledge of trains is shared.
Another possibility keeps the emphasis on the person with the noun phrase at the end:
Share your unique knowledge of trains with the hobbyist community.
But both of those versions essentially dismiss the original first part of the sentence.
Alternatively, asking questions could be retained if sharing is replaced with answering questions and knowledge is dropped (in order to keep it simple). Also as before, the noun phrase is moved to the start of the sentence:
The unique hobbyist community where you ask and answer questions about trains.
Or, depending on the emphasis:
The hobbyist community where you ask and answer unique questions about trains.
Of course, there are several variations of all of these examples.