It could be that he is wrongly perceived as dangerous. After all, he has survived the Killing Curse as a baby and Voldemort is always after him. People might be afraid to get close to him for fear of getting caught up in the dark wizard's wrath.
Maybe he has some sort of new power that he can't control at first. This power could be scaring people away. For instance, if he accidentally made people's wands go haywire whenever he was near, other students would likely avoid him. And over time, this could lead to him having no friends.
In the fanfiction, it might be that he has a different personality. What if he was more withdrawn and shy? In the original story, he was brave and friendly which attracted friends like Ron and Hermione. But if he was more introverted, it would be much harder for him to make friends at Hogwarts.
One of his friends could be a young werewolf who is struggling to control his condition. Harry, having faced his own challenges, would befriend him and help him find a way to live a more normal life in the wizarding world.
Harry Potter's friends in fanfiction vary a great deal. There are the international friends. Since Hogwarts is a British school but the wizarding world is global, in fanfiction, he could have friends from other magical schools around the world. These friends would bring in different magical cultures and techniques. Also, there are the friends who are from different time periods. Some fanfictions might introduce time - travel elements, and Harry could befriend wizards or witches from the past or future. His relationships with these friends can be complex, as they have different values and ways of life based on their time of origin.
Well, it could be that the friendship leads to some interesting cultural exchanges within the wizarding world. The Baskils might introduce Harry to some of their family traditions which are different from what he's used to in the wizarding world. For example, they could have a unique way of celebrating magical holidays. And Harry, in turn, could share his Gryffindor experiences and values with the Baskils. Maybe they end up collaborating to solve a mystery in the wizarding world that no one else could figure out because of their combined knowledge and skills.
His friends could be his main source of support. Hermione would probably be researching like crazy, trying to find any magical or Muggle solutions. Ron would be there by his side, cracking jokes to keep Harry's spirits up, even if the situation is tough.
He might focus on his studies. In the wizarding world, there are so many interesting magical subjects like Potions, Transfiguration. By burying himself in books and learning new spells, he can at least distract himself from the lack of friends.
He could make friends with a wizard from Australia who has a special ability to communicate with animals native to the Outback.
The plot could involve Byakuran getting lost in Harry's world. Luna discovers him and they become friends. Then they introduce Byakuran to Harry. Together, they form a sort of detective group within Hogwarts. They start to investigate strange happenings around the school that are related to a dark force from Byakuran's world trying to invade Hogwarts.
In some fanfictions, Harry could be betrayed by friends due to jealousy. For example, if a friend is jealous of Harry's fame as the 'Chosen One'. Another reason might be a misunderstanding. Maybe Harry is wrongly suspected of using dark magic, and his friends, without proper investigation, turn against him.
It could be Nagini. Even though in the original series she was more of a servant to Voldemort, in the fanfiction, she could have a different personality and form a bond with Harry.
Well, it could be about Harry Potter having some sort of special relationship with goblins. Maybe he discovers he has a connection to them because of his parents. For example, his father might have made a deal with the goblins and as a result, Harry is seen as a special figure among them. It could also involve Harry learning about goblin magic and culture which is quite different from what he's used to at Hogwarts.