The 5-year rule decides whether it is taxed at all
The whole question of EPF tax turns on continuous service. If you rendered 5 years or more of continuous service, counting service transferred from an earlier employer's recognised fund, the accumulated balance is exempt when you withdraw it, and there is nothing to pay. If you withdraw before completing 5 years, the exemption is pulled back and the withdrawal is taxed as if the fund had never been recognised.
That pull-back has three parts. The employer's contributions and the interest on them are taxed as salary; the interest on your own contributions is taxed as income from other sources; and the tax deductions you took under Section 80C on your own contributions in earlier years are added back and taxed in the year of withdrawal. So a pre-5-year withdrawal can carry a real tax cost across several heads, which is why the timing of when you leave and when you withdraw matters.
TDS at source, and why you cannot stop it as an NRI
On a taxable pre-5-year withdrawal, the fund deducts TDS at 10% under Section 192A where the amount is above ₹50,000, and at a higher rate if you have not given a PAN. This is only a deduction mechanism; your final liability is at your slab rate, so the 10% may be more or less than you actually owe.
A resident in this position can sometimes file Form 15G or 15H to have the TDS waived where their income is below the taxable limit. As a non-resident you cannot use those forms, they are for residents only, so an NRI's premature withdrawal will suffer the Section 192A TDS regardless, and the only way to recover any excess is to file an Indian return and claim the refund. A practising CA works out whether the withdrawal is even taxable and, where TDS was cut, reclaims what was over-deducted.
Taking the money out, and the sitting-balance trap
You can withdraw the full balance. The provident-fund scheme normally requires a two-month wait after leaving employment before a final settlement, but a member who is leaving India to settle abroad is exempt from that wait and can take the full balance immediately on emigration.
The trap is leaving the balance sitting in India for years before you withdraw. The exemption for EPF attaches to you as an employee, so once you cease employment, the interest credited to the account after that point is taxable, even though the corpus built up while you were employed was exempt. On top of that, an EPF account turns inoperative and stops earning interest a few years after you become eligible to withdraw. So a dormant EPF balance left untouched for a long time can quietly generate taxable interest and then stop growing, which is why it is usually better to deal with it around the time you leave rather than let it sit.