A.Master electrician Rex Cauldwell responds: There are more reasons not to do this than I can cover in this limited space. First of all, you cannot put the panel under anything. You cannot put it over anything. You cannot put it next to anything. There must a clear space in front of the panel for an electrician to stand. The space must be kept clear for at least 3 feet in front of the panel, and for 30 inches left to right in front of the panel. There must be at least 6 feet 7 inches of headroom, measured from the floor to the ceiling. The main breaker can be no higher than 6 feet 7 inches above the floor.
In your case, locating the panel under a counter would require an electrician to work on his or her knees when working in the panel. For this reason alone, the inspector would probably fail you.
to read the full article.