To answer this question, it is first very important to define productive efficiency and allocative efficiency. A firm is said to be productively efficient if it produces each good at the lowest possible unit cost. On a diagram, this is at the bottom of the Average Cost curve (where the Marginal Cost passes through it). Allocative efficiency is where firms are supplying the optimal mix of different goods and services that the consumer requires. For this to be the the Marginal Cost must equal the Average Revenue.
When a firm is in perfect competition, the Demand curve (as well as the Average Revenue and Marginal Revenue curves) is flat. This is because Demand is perfectly elastic due to the large number of firms, and due to consumers who will simply buy from other firms if any one firm raises their prices above the others. If a firm is making short-run abnormal profits then the lowest point of its Average Cost curve will be below the Demand curve. Firms will produce at the profit maximising point of output, where Marginal Cost is equal to Marginal Revenue. As already mentioned, Marginal Revenue is the same as Average Revenue in Perfect Competition and hence Marginal Cost is equal to Average Revenue. By our definition, this means the firm is allocatively efficient. However, since the Average Cost curve is below the Demand curve at its lowest point, the firm's choice of output will not be at the lowest point on the Average Cost curve and hence the firm is not productively efficient.
This answer should be read in conjunction with the standard basic diagram for a firm in Perfect Competition.