The following should demonstrate that six tests (7 "tries") is optimal.
To show n out of n+1 batteries are dead,
all pairings of the n+1 batteries must be tested. For n >= 1, we have n(n+1)/2 pairings.
1 test is required to show that 1 of 2 batteries is dead
3 tests are required to show that 2 of 3 batteries are dead
6 tests are required to show that 3 of 4 batteries are dead
And at 6 tests, this matches hexomino's solution without guaranteeing a working pair, so we can ignore this and the possibility of marking 4 in 5 as dead for the purposes of optimization.
Recall we're optimizing for the worst luck, so we consider that we won't find a working set of batteries until we definitively identify/eliminate the dead ones. This also means that eliminating batteries we don't know are dead is the same as eliminating live batteries.
This makes our goal:
1. eliminating four batteries as dead
2. keeping 2 other batteries not eliminated (which then must be live)
Some notes on brute-forcing:
For any group of n >= 3 batteries containing at least 1 dead battery and k >= 2 live batteries, the worst case requires we execute
n(n-1)/2 - k(k-1)/2 failed tests in order to identify all of the dead batteries (and hence the live ones).
As a corrollary, we can't identify individual live/dead batteries in a group if
we don't know that at least two are live, so brute-forcing a group isn't an option without at least two live batteries.
So, for example, take a group of 2 live batteries and 2 dead batteries.
If these are the only batteries we haven't eliminated, we must brute-force the group in order to identify both live ones, which takes 5 tests (suboptimal per hexomino's solution; 1 test alone can't identify a group of 2 live and 2 dead batteries), making the 2-live, 2-dead subproblem part of only non-optimal solutions.
We arrive at this subproblem by
running two tests to eliminate one dead and one live battery each,
so the optimal solution eliminates
one or fewer sets of 1 live, 1 dead.
Only 2 other scenarios remain:
If we eliminate one such set, we are left with 3 live, 3 dead after 1 test; brute-forcing from here is suboptimal, so we use 3 tests to eliminate 2 dead, 1 live to arrive at 1 dead, 2 live, which must be brute-forced and requires 2 more tests.
(total 6 tests)
If we don't eliminate any 1-live, 1-dead sets, our only option is using 3 tests twice, each time eliminating 2 dead, 1 live, to arrive at 2 live, which requires no further tests.
(this is hexomino's solution, which also requires 6 tests)