Please make your post more readable by writing the code between back ticks.
I'm not sure to understand what you need : is it the total number of comments belonging to the user among those inside the foreach loop ?
This can be done by adding the closure to with.
->with(['user' => function ($query) use ($topic) {
$query->withCount(['comments' => function ($query) use ($topic) {
$query->where('topic_id', $topic->id);
}]);
}])
Then you can access the comments count via the user.
@foreach ($comments as $comment)
{{ $comment->user->comments_count }}
@endforeach