you can try this using CSOM:
using (ClientContext ctx = new ClientContext(url))
{
ctx.Credentials = new SharePointOnlineCredentials(Admin, password);
//get all list items
List list = ctx.Web.Lists.GetByTitle(listName);
CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml = "<View Scope=\"RecursiveAll\"></View>";
ListItemCollection listItems = list.GetItems(camlQuery);
ctx.Load(listItems);
ctx.ExecuteQuery();
//get the user
User RemoveUser = ctx.Web.EnsureUser(username);
//get the list item
ListItem listItem = listItems.FirstOrDefault(t => t.DisplayName == FileName);
ctx.Load(listItem, lt => lt.HasUniqueRoleAssignments, lt => lt.RoleAssignments.Include(p => p.Member, p => p.RoleDefinitionBindings.Include(r => r.Name)));
ctx.ExecuteQuery();
//remove user
if(listItem.HasUniqueRoleAssignments)
{
foreach(RoleAssignment ra in listItem.RoleAssignments)
{
foreach(RoleDefinition rd in ra.RoleDefinitionBindings)
{
string[] member = ra.Member.LoginName.Split('\\');
if (member.Length > 1)
{
string m = member[1];
if (username == m)
{
ra.RoleDefinitionBindings.Remove(rd);
ra.Update();
break;
}
}
}
}
}
}