Use an if condition to modify the query based on the UserInfo.getUserId.
Or, you could try this Query
SELECT Id, Name, StageName, CloseDate, Amount,
Owner.Name,
Owner.UserRole.DeveloperName,
Owner.UserRole.Name
FROM Account
WHERE Id = :AccountId
AND OwnerId = :userId
And then filter the records based on the role.